I have a pgAdmin4 running within a Docker Container.
I'm trying to run on a custom path because there is another server running on the default /
path.
I've tried all possible env vars but as soon as pgAdmin runs, it redirects to /
and the page goes to the other server running.
pgadmin:
restart: always
container_name: pgadmin
image: dpage/pgadmin4:6.10
environment:
- PGADMIN_DEFAULT_EMAIL=someemail
- PGADMIN_DEFAULT_PASSWORD=somepassword
- PGADMIN_DISABLE_POSTFIX=true
#- PGADMIN_ENABLE_TLS=false
- PGADMIN_LISTEN_ADDRESS=0.0.0.0
- PGADMIN_LISTEN_PORT=80
- PROXY_X_FOR_COUNT=2
- PROXY_X_PROTO_COUNT=2
- PROXY_X_HOST_COUNT=2
- PROXY_X_PORT_COUNT=2
- PROXY_X_PREFIX_COUNT=2
networks:
- databases
- nginx
labels:
- "traefik.enable=true"
- "traefik.backend=pgadmin4"
- "traefik.frontend.priority=600"
- "traefik.frontend.rule=Method:GET"
- "traefik.frontend.rule=PathPrefix:/url-secreta/pgadmin"
I want the pgAdmin4 to respond on www.mywebsite.com/url-secreta/pgadmin
.
I've already defined the routes on my Kong gateway, but when the request reaches pgadmin it redirects to /
.
How can i fix it?
accroding to Container Deployment — pgAdmin 4 6.10 documentation
The SCRIPT_NAME environment variable has been set to tell the container it is being hosted under a subdirectory (in the same way as the X-Script-Name header is used with Nginx), and a label has been added to tell Traefik to route requests under the subdirectory to this container.
you should add SCRIPT_NAME
to your environment
pgadmin:
restart: always
container_name: pgadmin
image: dpage/pgadmin4:6.10
environment:
- PGADMIN_DEFAULT_EMAIL=someemail
- PGADMIN_DEFAULT_PASSWORD=somepassword
- PGADMIN_DISABLE_POSTFIX=true
#- PGADMIN_ENABLE_TLS=false
- PGADMIN_LISTEN_ADDRESS=0.0.0.0
- PGADMIN_LISTEN_PORT=80
- PROXY_X_FOR_COUNT=2
- PROXY_X_PROTO_COUNT=2
- PROXY_X_HOST_COUNT=2
- PROXY_X_PORT_COUNT=2
- PROXY_X_PREFIX_COUNT=2
- SCRIPT_NAME=/url-secreta/pgadmin # add this line
networks:
- databases
- nginx
labels:
- "traefik.enable=true"
- "traefik.backend=pgadmin4"
- "traefik.frontend.priority=600"
- "traefik.frontend.rule=Method:GET"
- "traefik.frontend.rule=PathPrefix:/url-secreta/pgadmin"