Issue with multi-layer routing and replacePath in Traefik

Hello Traefik team,

I am experiencing an issue with multi-layer routing in Traefik. Here is a minimal configuration example:

http:
  routers:
    root:
      entryPoints:
        - https
      rule: Host(`route.com`)
      middlewares:
        - flag
    sub:
      rule: Path(`/flag`)
      service: my-service
      parentRefs:
        - root

  middlewares:
    flag:
      replacePath:
        path: "/flag"

The intention is for the child router sub to match requests sent to / on host route.com, after the parent root router’s replacePath middleware changes the path to /flag.

However, all requests to / return a 404, indicating that the child router sub never matches, even though the path is replaced by the middleware.

Thank for you advice.

Had to read about multi-layer routing first (blog) :slightly_smiling_face:

Maybe enable Traefik debug log (doc) and Traefik access log in JSON format (doc) for further insights.