RedirectRegex middleware is not doing what I expect


I'm trying to set up RedirectRegex to take and turn it into, however instead it it turning it into and I have no idea how to fix that.

  - "traefik.http.routers.application.rule=Host(``)"
  - "traefik.http.routers.application.entrypoints=web,webSecure"
  - "traefik.http.routers.application.service=application"
  - ""
  - "traefik.http.routers.redirect.rule=Host(``)&&PathPrefix(`/c/`)"
  - "traefik.http.routers.redirect.entrypoints=web,webSecure"
  - "traefik.http.routers.redirect.middlewares=redirect@docker"
  - "traefik.http.middlewares.redirect.redirectregex.regex=^http://localhost/(.*)"
  - "traefik.http.middlewares.redirect.redirectregex.replacement=$${1}"

I've seen that PathPrefix "forwards the path as is" and have tried ^http://localhost/c/(.*) as the regex but saw no change. I've also tried hardcoding as the replacement but it still directed to

I have no idea what I am doing to make this not work as expected, any help pointing me in the right direction would be appreciated. Thanks

I ended up figuring out a solution.

I added a StripPrefix middleware after the RedirectRegex and that seemed to do the trick.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.