Redirects and regex in entrypoints

Hi folks,

I am switching from .toml to traefik storeconfig commands for my traefik app, but i am facing a problematic and have not seen the solution here or there..

I want to include in redirections with regex and replacement at entrypoint lvl, how can i do that ?

I used to do :

  address = ":80"
    regex = "^http://localhost/(.*)"
    replacement = "http://mydomain/$1"

but cant figure to make it work with something like :

- "--entrypoints=Name:http Address::80 Redirect.regex=^http://localhost/(.*) Redirect.replacement=http://mydomain/$$1"

tried also :

- "--entryPoints.http.redirect.regex=^http://localhost/(.*)"
- "--entryPoints.http.redirect.replacement=http://mydomain/$$1"

Thanks in advance :wink:

Hello @anthony.holderbaum,

Traefik v2 does not support entrypoint redirections.

Did you perhaps tag this as a v2 question when it is a v1 question?

Hi @daniel.tomcej,

Yes, i use the v1, my bad, i remove that label.

At the moment, i use an nginx service to forward as i want, needed to push the app in production this morning so..

But still curious to have the solution, who would be probably more effective.

Thanks !


The CLI args for entrypoints are found here:

Your initial attempt was really close:

- "--entrypoints=Name:http Address::80 Redirect.Regex:^http://localhost/(.*) Redirect.Replacement:http://mydomain/$$1"

Note that if you are using Kubernetes yaml, you do not need to escape the replacement with the double $$. If you are using docker compose, you do.