Intermittent issues with URL redirection


I'm running traefik v1.7 on docker swarm. Below are the labels on my traefik container.

"": "true",
"": "^https://[^/]+/(.*)",
"": "$1",
"": ","

So, the expected behaviour is, is expected to be redirected to

But, 3 out of 6 times I try to hit the URL, the resultant URL is being redirected to, and since this path is invalid, it results in 404 error.

Any ideas on how to check this further?

The last release of Traefik v1 was in 2021 (link), you should really update. No bug fixes and security fixes for over 2 years.

If you still want to move on, please format your code with 3 backticks before and after, or select and use </> button.

thank you @bluepuma77 . Updated the original description. I agree that the running version is very old. However I'm trying to resolve this intermittent issue first as this is impacting the application.

I think the $ in label needs to be escaped. This works in v2 and v3:

- traefik.http.middlewares.mywwwredirect.redirectregex.regex=^https://www\.(.*)
- traefik.http.middlewares.mywwwredirect.redirectregex.replacement=https://$${1}

From simple Traefik example.

thank you for the response.

but I'm not really sure if that fits to my use case? apologies if I did miss anything.

regex would match with any host.

So if I test the regex expression that I mentioned in my initial post, I can see that the regex is correctly replacing the host, but when this is in live, I sometimes see the redirection is not working as expected.