We have recently migrated our sites to docker swarm using Traefik as our reverse proxy. I have gotten the site working on the typical root domain www.example.com. However for legacy and SEO reasons, our site needs to sit in a /fr subfolder with the exception of the assets folder and the robots.txt file.
I have been trying to configure traefik to redirect all URLs with the exception of the assets folder and the robots.txt to the equivalent version under /fr
The first one is checked first, because the rule is longer. If it doesn't match, it will default to the second router, which will add the prefix when forwarding to the service.
Thanks a lot for this. While it didn't exactly work the way I wanted it to (probably my explanation was a bit off), it did point me in the right direction. Here is my the first working code which handles the redirects properly without looping.