Redirect to particular host depending on PATH


I have Traefik serving up multiple docker services (listmonk, matrix, matrixmmr) with SSL. They are listed like So,, Each have their own docker internal IP.

I'm trying to make Traefik route to a particular host depending on the PATH requested.

So if requesting I would like to pass that to ""
If requesting I would like to pass that internally to the docker host ""

Im aware of using PathPrefix, have used it before, but how do I re-direct based on the host and path from the beginning of the request from Traefik? Do I put them in the main Traefik docker service labels?

Thanks for any help

Regarding naming, a "redirect" is a http response to the client to visit a different address.

Sure you can do that with Docker labels on the according target containers:

      - traefik.http.routers.matrix.rule=Host(``) && PathPrefix(`/_matrix`)

      -``) && PathPrefix(`/_matrix/media`)

The 2nd one will be matched first, it has a higher priority because it is longer (more characters).