Reroute a route to another route

Hi, I have 2 routes, /routea and /routeb what i want to do is to redirect from /routea to /routeb so the request would go back to traefik and get processed again. However im unable to do this. Does anyone know how this would be achieved

[http]
  [http.routers]
     # Define a connection between requests and services
     [http.routers.to-routea]
      rule = "PathPrefix(`/routea`)"
      # If the rule matches, applies the middleware
      # If the rule matches, forward to the whoami service (declared below)
      service = "routea"
     
     [http.routers.routeb]
      rule = "PathPrefix(`/routeb`)"
      # If the rule matches, applies the middleware
      # If the rule matches, forward to the whoami service (declared below)
      service = "routeb"

  [http.services]
    # Define how to reach an existing service on our infrastructure
    [http.services.routea.loadBalancer]
      [[http.services.routea.loadBalancer.servers]]
        url = "http://private-ip:80"
    
    [http.services.routeb.loadBalancer]
      [[http.services.routea.loadBalancer.servers]]
        url = "http://traefik-docker-ip:80/routea"


this throws a 500 error

Does anyone have any ideas how i would achieve something like that? It needs to be rerouted like that.
Thanks in advance, Alex

Hello,

[http.routers]
  [http.routers.to-routea]
    rule = "PathPrefix(`/routea`) || PathPrefix(`/routeb`)"
    service = "routea"
    middlewares = ["redirect_routea"]
    
[http.services]
  [http.services.routea.loadBalancer]
    [[http.services.routea.loadBalancer.servers]]
    url = "http://private-ip:80"

[http.middlewares]
  [http.middlewares.redirect_routea.redirectRegex]
    regex = "^http://([^/])/routeb(.*)$"
    replacement = "http://${1}/routea${2}"

https://docs.traefik.io/v2.1/middlewares/redirectregex/

this does the job but from http standpoint its redirect, is there any way for it to happen without notyfying the browser that the redirect occured, aka display routea content at routeb adress?

[http.routers]
  [http.routers.to-routea]
    rule = "PathPrefix(`/routea`) || PathPrefix(`/routeb`)"
    service = "routea"
    
[http.services]
  [http.services.routea.loadBalancer]
    [[http.services.routea.loadBalancer.servers]]
    url = "http://private-ip:80"

thing is i need to call the second route, the accual thing i want to achieve is to have a docker provided routea
and file provided route b and in normal operation route b would show contents of routea (docker provided), but in high load route b would hit cache server

So:

[http.routers]
  [http.routers.to-routea]
    rule = "PathPrefix(`/routea`)"
    service = "svc"

  [http.routers.to-routeb]
    rule = "PathPrefix(`/routeb`)"
    service = "svc"
    
[http.services]
  [http.services.svc.loadBalancer]
    [[http.services.svc.loadBalancer.servers]]
    url = "http://private-ip:80"

not this but i just realized you can call a docker service from file so that solves the issue, thanks for help :3

I recommend to not use the file provider to define routers and services if you are using Docker.