Traefik version: 2.0.2
Providers: Docker
tl;dr: I am trying to redirect https://foo.example.com/wekan-favicon.png
to https://foo.example.com/board/wekan-favicon.png
Hi folks, I have a Wekan container being served at (eg) https://foo.example.com/board
via the label:
- "traefik.http.routers.rpg.rule=Host(
foo.example.com) && PathPrefix(
/board/)"
So far so good. However, although Wekan supports being served from a directory as opposed to the webroot, doing so breaks the favicon.
I figured I could rewrite around that with ReplacePathRegex. However, no matter what I try for the regex, I cannot seem to to get one that works as intended.
For example:
# Fix favicon
- "traefik.http.middlewares.fix-favicon.replacepathregex.regex=^/wekan-favicon.png"
- "traefik.http.middlewares.fix-favicon.replacepathregex.replacement=/board/wekan-favicon.png"
- "traefik.http.routers.wekan.middlewares=fix-favicon"
I have tried several variants, including the entire URL, but cannot hit upon the right regex. All I end up with is either a plain traefik 404, as if the middleware isn't applied or the regex isn't matched; though I can tell it is being applied as it affects the target URL (https://foo.example.com/board/wekan-favicon.png
) which then returns a 404 via Wekan if I specify a lax enough regex.
The Problem: I think the problem is that https://foo.example.com/wekan-favicon.png
obviously does not match the PathPrefix
rule for that router, so it never gets a chance to hit the middleware I have set up.
Is there a way I can get around this? Could I create a router that matches Host=(https://foo.example.com)
and does not route to a service, but triggers a redirect on the path /wekan-favicon.png
?
I'm fairly inexperienced with traefik and still muddling through, so the way forward isn't obvious to me and some of my terminology may be off. If there's anything about the issue I can clarify please let me know, and thanks in advance