I am trying to use a redirectregex in Traefik (traefik:v2.9.1 ) - my container has the following labels:
I am simply testing the regex/redirect code - so that if I open any URL that starts with https://nbs2.csw.met.no/ -- I should be redirected to https://nbs.csw.met.no/
but seems my traefik instance is ignoring those instructions - can't find anything in the logs - thanks for any help!
You need to define a
router that matches with
rule and assign the middleware to it. See this simple example.
Thank you so much! adding the router line fixes the issue
I will now have to deal with my regex rule .. fighting to get a question mark out of the URL
but it is probably an issue with regex itself and not traefik
my rules are:
so that an URL like:
will be redirected to:
but instead it returns:
(note the question mark at the end)
I tried on the playground suggested in the traefik documentation regex101: build, test, and debug regex and I get the same issue
got it to work adding some escape and making sure to use single quote in the yaml file - thanks @bluepuma77 for your help!!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.