Reverse proxy to external host kubernetes

Hey,
I have a product that where each customers instance is deployed in different kubernetes clusters. Each cutomer has a partner api where external parties can integrate. So each integration point is on different domains. Is it possible to use traefik to in kubenetes to route to external domains.

Example:
Customer A and B has its partner api like this:
https://A.example.com/partners/api/v1/{customerId}/Some-Endpoint
https://B.example.com/partners/api/v1/{customerId}/Some-Endpoint

Goal:
have a route that is https://partners.example.com/api/v1/{customerId}/Some-Endpoint
if {customerId} is equal to A it should proxy the request to https://A.example.com/partners/api/v1/{customerId}/Some-Endpoint and vice versa for B.

Is this possible, the closes i come is to add a service with type ExternalName in k8s, but this will redirect the request to the correct domain and not just reverse proxy the request.

Hi @jensw

You should be able to reach that using RedirectRegex as a middleware.

E.g:

# Redirect with domain replacement
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-redirectregex
spec:
  redirectRegex:
    regex: ^http://localhost/(.*)
    replacement: http://mydomain/${1}

Link to the page RedirectRegex

Cheers

Won't that do a redirect (301 or 302)? That's not the behavior I won't more like proxypass in nginx.

Hi,
Anyone has another suggestion or is it not possible to do this in kubernetes?