I'm trying to convert the below Nginx conf to a Traefik setup, but I'm not sure how to extract the subdomain from the server name (in this case, the ״repo״ template) and rewrite it to the appropriate URL.
The following is the Nginx conf snippet that allows that:
You can also confirm the loaded rule in the dashboard, and you may have to modify the rule formatting slightly depending on the nesting of your strings inside strings (escaping quotes as required).
Thank you for your response; I have made the necessary changes to the setup, unfortunately, I am still unable to find a solution that fits my use case, perhaps a screenshot would help:
You are correct in that the capture groups from one section of Traefik are not capable of being reused in another.
One question: are you looking to replace a path on the backend request? or are you trying to redirect the client to a new URI?
replacePathRegex is used for the former, and only can operate on paths. The latter you can use RedirectRegex - Traefik which allows capture groups and replacements across the request.
Note that redirectRegex will return a 30X, and force a client redirect, so the URI will not be hidden from the user, however this may not be an issue for you.
Thank you for your help.
I am trying to replace a path on the backend request, is there a possible workaround?
In Nginx, the capture group is shared across the entire configuration file, thus making it easily achievable.
This is well beyond a year old. Were you ever able to get this working? I'm having the same issue and my Googling is turning up lots of users asking the same question.