Regex proxying without redirect

Hello. I am trying to use Traefik to proxy requests transparently from:
https://subdomain.example.com/my/path
to
https://internet.com/static/subdomain/my/path

The closest i've found is RedirectRegexp, but that only generates a 302 Location redirect.
Is it possible to use regex at the service level?

Regards, Christoffer

Hello,

Are you asking how to do that redirect so that it would work for any arbitrary "subdomain" part, i.e. any first subdomain part would dynamically become the second element of the path prefix? If yes, I do not think that is possible to do.

However, if you want to do it for a predefined static subdomain so that e.g https://foo.example.com/my/path forwards to https://other.domain.com/static/foo/my/path, then I think you can simply do it with a host Rule that matches on foo.example.com on the router, and a service (referenced by said router) that has https://other.domain.com as one of its servers.

hth,
Mathieu

Hey mpl.
I wanted to proxy it dynamically with regex, but soon found out that Traefik didn't support that. I solved the problem by placing an Nginx proxy as a Traefik service and letting Nginx handle the proxying instead of Traefik.

Inside Nginx, I get the complete URL by looking in $http_x_forwarded_host, and doing regex on that variable. Then I just proxy_pass to the wanted URL based on the result of the regular expression.

This works nice.

Hi @mpl. We have the same scenario as csamu. Do we have a plan to implement this feature in Traefik? Otherwise, we need to add additional hop (from traefik to nginx).