postfixadmin / docker

Docker Image for PostfixAdmin
https://hub.docker.com/_/postfixadmin
GNU General Public License v2.0
73 stars 21 forks source link

config to set url/basepath for reverse proxy #51

Closed duprasf closed 1 year ago

duprasf commented 2 years ago

Bonjour,

Would it be possible to add a configuration to set the absolute path for postfixadmin. This is essential when working with Reverse Proxies. I believe this is what was requested in #37.

Context

I'm building a new servers and decided to go with a Docker first approach, if it can be done with a container, I'm not installing on the OS. To manage all of these containers I'm using traefik as a proxy, this allows me to set postfixadmin in https://domain.com/postfixadmin so it is redirected to the right container. However, in containers, the path is converted to / so when the login.php page is returned it goes to https://domain.com/login.php instead of https://domain.com/postfixadmin/login.php

Would like to see

docker run -d --name postfixadmin \
    --label traefik.enable=true \
    --label 'traefik.http.routers.postfixadmin.rule=Host(`domain.com`) && PathPrefix(`/postfix`)' \
    --label 'traefik.http.routers.postfixadmin.middlewares=postfixadmin-stripprefix' \
    --label 'traefik.http.middlewares.postfixadmin-stripprefix.stripprefix.prefixes=/postfix' \
    --label 'traefik.http.middlewares.postfixadmin-stripprefix.stripprefix.forceslash=false' \
    --label 'traefik.http.middlewares.proto.headers.customrequestheaders.X-Forwarded-Proto=https' \
    --label traefik.http.routers.postfixadmin.entrypoints=https \
    --label traefik.http.routers.postfixadmin.tls=true \
    --label traefik.http.routers.postfixadmin.tls.certresolver=letsencrypt \
    -p 9186:80 \
    -e POSTFIXADMIN_DB_TYPE=mysqli \
    -e POSTFIXADMIN_DB_HOST=mariadb \
    -e POSTFIXADMIN_DB_USER=postfixadmin \
    -e POSTFIXADMIN_DB_PASSWORD=password \
    -e POSTFIXADMIN_DB_NAME=postfixadmin \
    **-e POSTFIXADMIN_ABSOLUTE_URL=/postfixadmin \**
    postfixadmin

Other project example

This would be similar to phpmyadmin's PmaAbsoluteUri configuration https://docs.phpmyadmin.net/en/latest/config.html#cfg_PmaAbsoluteUri

Thanks

DavidGoodwin commented 2 years ago

If I understand this rightly, it's really a change that would need to be made in postfixadmin/postfixadmin - where any links in the html templates would need to be either relative or respect a defined prefix?

duprasf commented 2 years ago

I guess you are right (except that it would have to be with a defined prefix, not relative due to the nature of using a reverse proxy with docker), but since it would only be useful when using docker I opened it here.

Can the issue be transferred or is it better if I open another issue in postfixadmin/postfixadmin?

DavidGoodwin commented 1 year ago

I don't think it's possible to transfer a ticket between repositories.

see ^