Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1neuyT-0003p2-Sx for pgadmin-hackers@arkaria.postgresql.org; Thu, 14 Apr 2022 08:37:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1neuyS-0003F4-Gx for pgadmin-hackers@arkaria.postgresql.org; Thu, 14 Apr 2022 08:37:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nehxH-0000rF-AJ for pgadmin-hackers@lists.postgresql.org; Wed, 13 Apr 2022 18:43:04 +0000 Received: from mail-bn7nam10olkn2011.outbound.protection.outlook.com ([40.92.40.11] helo=NAM10-BN7-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nehxD-0003Tf-TR for pgadmin-hackers@postgresql.org; Wed, 13 Apr 2022 18:43:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c2doLYEYkDtL+MeodfLHS/Pw+iiPAHUh/lxqtssX07PNz1Da0P+1b3a+yjW9hBKuw0WKf/4N6lTMhBKjxSjTIEzLlPcLn+eki5umUsGKAqWEGdhAwoHFAFWEqb+ZlR7su/MQIiioG1LS50WQYWVid8Bj2I2ZXXFl4BOtJ+cYrlFcdXa1uK8jvrQ+jgw6b6RMyK9k/0DLJp+VZHJ6I8HOnFpGmhgN5MGBVd2mPwTf9Q2/hUTmVt6nDoAJ9HVL2YujrgaVc2TVNXLLIdZYQ0Au4xBjh62c5cIi4jMVJLqg54BdhveCHv6Yfv135Y4nQH3Ck8lBq3iTfQV4kjUXM60f2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SedhqXI4wzR9pwPPgEapcec9OKbx2AxuVxQZx2Pwc3g=; b=XZNQDPt1BEVOe5xUCNo5AiYX7uZrErYtDK60svMAIHvfvNHWmtUDq4yzlibKJagU8+KOYC77NCH7lflsExmszkrv4qymMqVH55KNh58DrPDsC3KWJDj31MsRHKXd83+o7nLBbuLLzJHgfx2/48azK8xqhB32O503PE8V0uwLWwCU59Fwrj7TtRtyKECdofmtFBR88puJgy2etBTuqIJgI4XvxAeMR9ZHfBaQTppz5z1htX5eqSFlDUyletBMHSYxFfUyOkOOl8MuiP+jdGuJAy8a0RruPmCIHicDNTOAcEvlC7mqFGY9c6aPVoROraKB10DcIGkv+skqkGKcKOO7Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SedhqXI4wzR9pwPPgEapcec9OKbx2AxuVxQZx2Pwc3g=; b=OGIkRiWtYT1h+TkOeOYHVIOjo6WDVe5q5qGuM7PEq3Vk7AvQRf0mwrVCNJSpHCkbcH/bozNXeIB8qTqjwC0zZCzwV/wvoWa2j9Dp2yWa0ls2I/Jzw/kXChmZccBx8w1QBSLP0RT/O6EhQRD4gt2r+okd6kSoqRfOZ4BOubi4CsCzOeJr5EnEYovYaK4JBAKCckp6X7IIL1/7au8tIBkTmFNilMr4giEVqXcROrEb8hOXq5lM1ULMAhDsrKMr18Vt145RfmI2H8G/JctiqGYKF9aCO5hL0RrnuNBA03gT1eco/LOFZl1XL6vjxA/OEaFNb/IPPZspmy+S0zlr8vBtyQ== Received: from MW4PR17MB4513.namprd17.prod.outlook.com (2603:10b6:303:7f::16) by MW4PR17MB4276.namprd17.prod.outlook.com (2603:10b6:303:75::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Wed, 13 Apr 2022 18:42:55 +0000 Received: from MW4PR17MB4513.namprd17.prod.outlook.com ([fe80::edab:31e7:ab5d:358b]) by MW4PR17MB4513.namprd17.prod.outlook.com ([fe80::edab:31e7:ab5d:358b%2]) with mapi id 15.20.5144.030; Wed, 13 Apr 2022 18:42:55 +0000 Content-Type: multipart/alternative; boundary="------------gI6exoK1Dkd9aa2xA7lbn1lu" Message-ID: Date: Wed, 13 Apr 2022 11:40:47 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: pgAdmin Docker container: specify web URL path prefix? Content-Language: en-US To: Yogesh Mahajan Cc: pgsql-admin@lists.postgresql.org, pgadmin-hackers References: From: Glen Bakeman In-Reply-To: X-TMN: [yfWKTEw0G7xV30/UUsQ4MWzQcLRyGxkGTzxhPDxgWYKJ2//xON8DVevPEjfzSepu] X-ClientProxiedBy: SN4PR0701CA0037.namprd07.prod.outlook.com (2603:10b6:803:2d::32) To MW4PR17MB4513.namprd17.prod.outlook.com (2603:10b6:303:7f::16) X-Microsoft-Original-Message-ID: <4bb64999-a5ea-a433-bebb-ec293db95659@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d922b81-4320-42e3-3a4c-08da1d7d6c78 X-MS-TrafficTypeDiagnostic: MW4PR17MB4276:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N3Pa37Xcl0NBWaSSAuoPxM7maPMikpcl2P6nISn+sPyTZmfC4QqsCm6fAsxkHx5VdNwfVX/9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QW5ZdVUyWEk5?= =?utf-8?B?VWpvVE9PU3MvUENUaUgraUZJbWxKZmhZenY4djR3U2xGTFBjUGcxS09yYWJW?= =?utf-8?B?M0hvTlo1NGxSZ3pYOW4vQlk1cmJBRkJreTZwRklWTTM2WExoQXZmRGdWa1Y2?= =?utf-8?B?eS9zWkZEeGFKYjFzaWdZRXRQWnZCZVRxNzZqRWJaYXYrOW5rMDBacTV3NWYr?= =?utf-8?B?TlJjQjBpRGRMOE8xU2h2ZXpYRXRNN0tES1VjT0NHQ3J2cjFXRVhZOEtoSG1z?= =?utf-8?B?MVpzdEsya2gvME1KTGRVeW5sM2pLWmtkNXhSRm9Kb082dzl3WlpSUnVPL05F?= =?utf-8?B?MXM3ZC9nTzhYQURUaXRkeUdvdXNlSzh0NHFIRzVqcUYwcERBTGxseHVaTVVP?= =?utf-8?B?RU1jaUZidWx2NVh3bWYzM21tTFU3ZDJkenZQMkdaTEx2SDdMMlJJbXgzZVRv?= =?utf-8?B?RmNZL3JkdVhzd3RVNHdwdUFleHpJRGUycGpxWHlZQnJlaGFWUkRHeUtQTkxN?= =?utf-8?B?Unh2WXg1a1RWczVCVmU4ZUJVMlRMeUFjNlM1WWV4a2t3dkVTb1pidTJwVHZz?= =?utf-8?B?MWZRTHNxbWMxRlByclMrRjZPQU9Va1NPTFpEUmVsMjM2TEhOMlpicXZxZXJ3?= =?utf-8?B?K3Z5ekl2TEw0dy9vT09MN2EwRGs0aTdkVW5KVDRBK0tvTzdpVDZRRE5xcGVD?= =?utf-8?B?RzFiUEROdG81VnVFWUxySWR6U2tGTk13d21obVllaHdMcTVGSTJKY1BBUGFz?= =?utf-8?Q?Ehf/CJsIg4G7mT+ruDEl2YsdX7OtVQ=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-c704e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 6d922b81-4320-42e3-3a4c-08da1d7d6c78 X-MS-Exchange-CrossTenant-AuthSource: MW4PR17MB4513.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2022 18:42:55.7875 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR17MB4276 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --------------gI6exoK1Dkd9aa2xA7lbn1lu Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Of course! My docker labels are as follows: - "traefik.http.routers.pgadmin4.rule=Host(`host.example.com`) && PathPrefix(`/pgadmin4`)" - "traefik.http.routers.pgadmin4.tls=true" This assumes that the chosen name for the instance is "pgadmin4", which is entirely up the user. The Host portion was necessary because Traefik will complain otherwise about a lack of specificity in the rule. I also added the .tls line since Traefik will only forward insecure requests without it (not sure why yet). Otherwise, Traefik is able to automatically identify the necessary port on the service to communicate with. I added the SCRIPT_NAME environment variable which seemed to be the key I was missing. Thanks again for your help, Glen On 4/12/2022 10:19 PM, Yogesh Mahajan wrote: > Glad to hear it! > Can you please share what additional steps are required? > > Thanks, > Yogesh Mahajan > EnterpriseDB > > > On Wed, Apr 13, 2022 at 7:49 AM Glen Bakeman wrote: > > Yogesh, > > Not only was my DuckDuckGo-fu failing me, I didn't even get to the > bottom of the page... > > I had to make a few small tweaks since I'm on Traefikv2, but I'd > be happy to update the documentation. Thank you for putting me in > the right direction! > > Glen > > On 4/11/2022 9:11 PM, Yogesh Mahajan wrote: >> Hi Glen, >> >> Please refer to the last point at this >> >> web-page for hosting pgadmin4 under subdirectory with Traefik. >> Here is example when pgadmin4 is hosted under /pgadmin4/ >> docker run --name"pgadmin4" \ >> -e"PGADMIN_DEFAULT_EMAIL=user@domain.com" \ >> -e"PGADMIN_DEFAULT_PASSWORD=SuperSecret" \ >> -e"SCRIPT_NAME=/pgadmin4" \ >> -l"traefik.frontend.rule=PathPrefix:/pgadmin4" \ >> -d dpage/pgadmin4 >> >> Thanks, >> Yogesh Mahajan >> EnterpriseDB >> >> >> On Tue, Apr 12, 2022 at 6:23 AM Glen Bakeman >> wrote: >> >> Hi everyone, >> >> I'm getting into containerized hosting, and I'd like to setup >> the >> pgAdmin docker container with a reverse proxy (Traefik). Traefik >> supports Path Prefix proxying for services (i.e, I'd like to >> access >> pgAdmin at host.example.com/pgadmin/ >> ). The issue seems to be that >> pgAdmin automatically rewrites requests to >> host.example.com/login , which >> breaks the proxy. >> >> I can't seem to find any options that allow us to specify the >> web path >> pgAdmin uses, from the perspective of configuring the docker >> container. >> Can anyone please confirm this? >> >> Thanks in advance, >> >> Glen >> >> >> --------------gI6exoK1Dkd9aa2xA7lbn1lu Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Of course! My docker labels are as follows:

- "traefik.http.routers.pgadmin4.rule=Host(`host.example.com`) && PathPrefix(`/pgadmin4`)"
- "traefik.http.routers.pgadmin4.tls=true"

This assumes that the chosen name for the instance is "pgadmin4", which is entirely up the user. The Host portion was necessary because Traefik will complain otherwise about a lack of specificity in the rule. I also added the .tls line since Traefik will only forward insecure requests without it (not sure why yet). Otherwise, Traefik is able to automatically identify the necessary port on the service to communicate with. I added the SCRIPT_NAME environment variable which seemed to be the key I was missing.

Thanks again for your help,

Glen

On 4/12/2022 10:19 PM, Yogesh Mahajan wrote:
Glad to hear it! 
Can you please share what additional steps are required?

Thanks,
Yogesh Mahajan
EnterpriseDB


On Wed, Apr 13, 2022 at 7:49 AM Glen Bakeman <gbakeman@live.com> wrote:

Yogesh,

Not only was my DuckDuckGo-fu failing me, I didn't even get to the bottom of the page...

I had to make a few small tweaks since I'm on Traefikv2, but I'd be happy to update the documentation. Thank you for putting me in the right direction!

Glen

On 4/11/2022 9:11 PM, Yogesh Mahajan wrote:
Hi Glen,

Please refer to the last point at this web-page for hosting pgadmin4 under subdirectory with Traefik.
Here is example when pgadmin4 is hosted under /pgadmin4/
docker run --name "pgadmin4" \
    -e "PGADMIN_DEFAULT_EMAIL=user@domain.com" \
    -e "PGADMIN_DEFAULT_PASSWORD=SuperSecret" \
    -e "SCRIPT_NAME=/pgadmin4" \
    -l "traefik.frontend.rule=PathPrefix:/pgadmin4" \
    -d dpage/pgadmin4

Thanks,
Yogesh Mahajan
EnterpriseDB


On Tue, Apr 12, 2022 at 6:23 AM Glen Bakeman <gbakeman@live.com> wrote:
Hi everyone,

I'm getting into containerized hosting, and I'd like to setup the
pgAdmin docker container with a reverse proxy (Traefik). Traefik
supports Path Prefix proxying for services (i.e, I'd like to access
pgAdmin at host.example.com/pgadmin/). The issue seems to be that
pgAdmin automatically rewrites requests to host.example.com/login, which
breaks the proxy.

I can't seem to find any options that allow us to specify the web path
pgAdmin uses, from the perspective of configuring the docker container.
Can anyone please confirm this?

Thanks in advance,

Glen



--------------gI6exoK1Dkd9aa2xA7lbn1lu--