I have a service that requires to have /admin
appended to the host URL (namely Pi-hole).
A few examples of the "raw" usage (without proxy):
http://192.168.10.2:28080/
→ returns a 403 because/admin
is not appendedhttp://192.168.10.2:28080/admin
→ redirects tohttp://192.168.10.2:28080/admin/login.php
http://192.168.10.2:28080/admin/
→ after authenticationhttp://192.168.10.2:28080/admin/settings.php
→ an example of a page when browsing the site
So an /admin
prefix is needed everywhere.
In order to transform http://192.168.10.2:28080/admin
to https://pihole.swtk.eu
I used a dynamic file configuration:
http:
routers:
pihole:
rule: Host(`pihole.swtk.eu`)
service: pihole
middlewares:
- pihole
services:
pihole:
loadBalancer:
servers:
- url: http://192.168.10.2:28080
middlewares:
pihole:
addPrefix:
prefix: "/admin"
It almost works:
pihole.swtk.eu
typed in the omnibox leads tohttps://pihole.swtk.eu/login.php
→ this is OK, it is the login page behind/admin
- after logging in I get a
404 Not Found
→ but I noticed that the URL in the browser is
https://pihole.swtk.eu/admin/
→ the/admin
was added by the middleware but it makes the call actually go tohttp://192.168.10.2:28080/admin/admin/
, there is an extra/admin
appended ←the problem is here
- if I remove
/admin
from the URL (which is nowhttps://pihole.swtk.eu/
) the site works well in all places. To take the example if the raw access, the settings are athttps://pihole.swtk.eu/settings.php
.
I would appreciate some help understanding why the extra /admin
is appended, or how to say to Traefik append /admin
only if there is no /admin
already