We're using traefik to reverse proxy our microservices environment, running on kubernetes in staging and prod, and docker-compose locally. We're trying to proxy requests to specific URLs to specific microservices, so that, for example, the "orders" microservice serves the API and UI for that concern in our system. We're aiming for our services to be agnostic to the URL on which they're serving so, for example, the "orders" microservice serves on /
, but traefik proxies requests from http://api.me.com/orders/{id}
with a PathPrefixStrip
of orders
to e.g. http://orders.svc.kubernetes.local/{id}
. I'm trying to resolve an issue where the service needs to know which URL it is serving on so that the URLs it writes out includes the value specified in PathPrefix
, but I don't like having to duplicate the knowledge of the PathPrefix
across traefik and the application. Is this something that just "has to be done" in this scenario, is traefik capable of rewriting URLs in the responses, or is there some other technique that we can/should apply to achieve this?
Note: I have already read these three similar questions and have not found the answer there.