Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to version 5.6.0 and add prefix path for reverse proxies #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pletessier
Copy link

No description provided.

@Turgon37
Copy link
Owner

Hello, I've noticed that you are looking for adding a prefix in the url where phppgadmin is reachable. But your changes require to modify the entire image build process.
First of all, I suggest you to put the prefix logic in your reverse proxy instead of this image. For example Apache or Nginx car be configured to use a prefix and remove it when translate the query to the final backend (as explained here https://serverfault.com/questions/379675/nginx-reverse-proxy-url-rewrite/725433#725433)
Then, if you can't do this in reverse proxy (because it is handled by another team), we can put it in the nginx configuration of the docker image.

Just tell me

@pletessier
Copy link
Author

Hello,
I already tried to strip the prefix "phppgadmin" in my reverse proxy (Traefik), but it only works for the "index.php" file. But, for all other resources ("themes/default/global.css", "libraries/js/jquery.js", ...), the prefix is then missing. Maybe it should be a config to add in php ? I'm not a php dev...
In any case, I would prefer a dynamic config (env var), my proposal is just a dirty workaround.

@Turgon37
Copy link
Owner

I've just to test on my side with a configuration like the following it's work fine

version: '3.2'
services:
  traefik:
    image: traefik
    restart: always
    command: --api --docker # Enables the web UI and tells Traefik to listen to docker
    ports:
      - "80:80"     # The HTTP port
      - "443:443"   # The HTTPS port
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock # So that Traefik can listen to the Docker events
    labels:
      - "traefik.enable=true"
      - "traefik.port=8080"
      - "traefik.entryPoint=https"
      - "traefik.backend=traefik"
      - "traefik.frontend.rule=Host:localhost"

  phppgadmin:
    image: turgon37/phppgadmin:develop-nginx-56-5.6.0-2.0.1
    labels:
      - "traefik.enable=true"
      - "traefik.port=80"
      - "traefik.backend=phppgadmin"
      - "traefik.frontend.rule=PathPrefixStrip:/phppgadmin"

The prefix exist only on the user agent side as proved by the nginx logs

"GET /intro.php HTTP/1.1" 200 4722 "http://localhost/phppgadmin/"
"GET /themes/default/global.css HTTP/1.1" 200 6426 "http://localhost/phppgadmin/intro.php"
"GET /libraries/js/jquery.js HTTP/1.1" 200 92793 "http://localhost/phppgadmin/intro.php"

Then the assets urls are also correctly build

image

Can you share the relevant part of your Traefik configuration ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants