Multiple paths in Traefik pointing to the same path in backend in Kubernetes

9/18/2018

Is there a way to make a kubernetes service available under multiple paths via traefik ingress, but sending requests to the backend only with one path?

e.g. https://example.com/mainpath/api and https://example.com/otherpath/api should both send requests with /mainpath/api to the backend

-- Thomas Einwaller
kubernetes
traefik
traefik-ingress

1 Answer

9/18/2018

Sure, use two different ingresses, one relatively normal, the other with the traefik.ingress.kubernetes.io/rewrite-target: /mainpath/api annotation. Your backend will have to check the X-Replaced-Path header if it cares to be able to tell the difference.

-- coderanger
Source: StackOverflow