I've been looking endlessly and I can't seem to find any updated posts or documentation on how to do this properly.
I simply have a service running in docker which is running on port 34400, and I want to do a reverse
proxy to a path that I define in Traefik 2.6.3 using docker labels in docker-compose.
I've seen multiple ways that seem to be able to do this, but a lot are looking at Traefik v1.
There are some caveats with the docker service, the service seems to run two endpoints:
- First endpoint is just the base path, which in this case is 192.168.96.2:34400/
- Second endpoint is running 192.168.96.2:34400/web
So my question is, how can I route the docker service to something like <mydomainname>/<mynewservicename>
?
Because the root path is sitting at / how do get this:
- First
https://<mydomainname>/<mynewservicename>
- Second
https://<mydomainname>/<mynewservicename>/web
I've used a mixture of middlewares, but I can't seem to get them working:
-
stripprefix
(to strip /web) -
addprefix
(to add /mynewservicename) -
replacepathregex
(to move from /web to /mynewservicename)
I've also tried doing something like this:
- "traefik.http.routers.mynewservicename.rule=Host(`mydomain`)"
or
- "traefik.http.routers.mynewservicename.rule=Host(`mydomain`) && Path(`mynewservicename`)"
or
- "traefik.http.routers.mynewservicename.rule=Host(`mydomain`) && PrefixPath(`mynewservicename`)"
or
- "traefik.http.routers.mynewservicename.rule=Host(`mydomain`) && PrefixPath(`web`)"
Clearly I'm missing something here, the documentation is very short, so I'd appreciate some help here.