Proxy to a subfolder in a container

I found many examples, on how to decide by a subfolder in a path which container to choose. What is not found is how to redirect to a subfolder. In my example I want to realize the following:

https://domain.com/ab -> https://mycontainer/kdav/ab
https://domain.com/gg/aa -> https://mycontainer/kdav/gg/aa
... and so on.

My current config of the container is:

traefik.http.routers.kdav.entrypoints=websecure,web
traefik.http.routers.kdav.rule=Host(domain.com)
traefik.http.routers.kdav.tls.certresolver|myresolver
traefik.http.services.kdav.loadbalancer.server.port=9080

How to add the subfolder redirect?

Hi @stefangries

You'll want to use the AddPrefix - Traefik middleware for that.

Bear in mind you may need to configure/change you backend so that /kdav ir not returned in any returned uris.