To complement defaultRule to get the service name without the stack 15
I am trying to make a common middleware that would strip the path prefix
- traefik.http.middlewares.strip-prefix.stripprefixregex.regex=/[a-z0-9_]+
However, this causes an issue if I don't put the trailing slash. For example if I put in /whoami2 it keeps it at /whoami2, I want it to redirect to /whoami2/
This is because some apps like Portainer will not work if the path is /portainer
but works with /portainer/
I would rather not put in a /
at the end explicitly either.
I also tried (updated based on comment by @zespri
- traefik.http.middlewares.strip-prefix.replacepathregex.regex=^/[a-z0-9_]+
- traefik.http.middlewares.strip-prefix.replacepathregex.replacement=/
I also did the following which uses a redirectregex
also no luck
- traefik.http.middlewares.strip-prefix.chain.middlewares=strip-prefix-1,strip-prefix-2
- traefik.http.middlewares.strip-prefix-1.redirectregex.regex=^(https?://[^/]+/[a-z0-9_]+)$$
- traefik.http.middlewares.strip-prefix-1.redirectregex.replacement=$${1}/
- traefik.http.middlewares.strip-prefix-1.redirectregex.permanent=true
- traefik.http.middlewares.strip-prefix-2.stripprefixregex.regex=/[a-z0-9_]+
created
Sep '19last reply
- 19
replies
- 2.6k
views
- 7
users
- 7
likes
- 5
links