Path Redirection

Hi, I'm trying to set up Traefikv2 to redirect any request from / -> /foo, and seem to be running into an issue that I'm missing completely. I don't seem to be getting any errors in the Traefik log. I would just serve it off / but there are other backends I eventually want to serve on different paths.

Thanks in advance!

Here is my traefik.toml:

[entryPoints]
  [entryPoints.web]
    address = ":80"
  [entryPoints.websecure]
    address = ":443"

[providers]
  [providers.file]
    filename = "rules.toml"
    watch = true

[log]
  level = "DEBUG"

[serversTransport]
  insecureSkipVerify = true

Here's my rules.toml:

[http.routers]
  [http.routers.http_forwarder]
    rule = "HostRegexp(`{any:.+}`)"
    entryPoints = ["web"]
    middlewares = ["https_redirect"]
    service = "foo-service"
  [http.routers.foo_root_forward]
    rule = "Path(`/`)"
    middlewares = ["root_redirect"]
    service = "foo-service"
  [http.routers.foo]
    rule = "PathPrefix(`/foo`)"
    entryPoints = ["websecure"]
    service = "foo-service"
    middlewares = ["foo_prefix_strip"]

[tls.stores]
  [tls.stores.default]
    [tls.stores.default.defaultCertificate]
      certFile = "ssl.crt"
      keyFile = "ssl.key"

[http.services]
  [[http.services.foo-service.loadBalancer.servers]]
    url = "http://localhost:8080"

[http.middlewares]
  [http.middlewares.https_redirect.redirectScheme]
    scheme = "https"
    permanent = true
  [http.middlewares.root_redirect.replacePath]
    path = "/foo"
  [http.middlewares.foo_prefix_strip.stripPrefix]
    prefixes = ["/foo"]

I previously did it in Traefikv1.7 with something like this:

  [frontends.frontend_redir.redirect]
  regex = "&https?://(.*)/(.*)"
  replacement = "https://$1/foo/$2"
  permanent = true

I believe I figured out the issue!

I needed to add this line to my two HTTPS routers (foo_root_forward & foo):

[http.routers.foo.tls]

foo being w/e your router name is (foo or foo_root_forward in my case)

If I understand your question, why do not use RedirectRegex ?
ReplacePath is for the backend.
So, as far as I understand, ReplacePath adds /foo and StripPrefix removes /foo, so it is basically a null operation.
Am I wrong?