Hi,
I have an ingress configured with host : domain.com.
Can I redirect everything from the URL https://www.domain.com to https://domain.com ?
Thanks
Hi,
I have an ingress configured with host : domain.com.
Can I redirect everything from the URL https://www.domain.com to https://domain.com ?
Thanks
Hello @nowel.hermans,
What version of Traefik are you using?
Hi @daniel.tomcej ,
I am using traefik:1.7.19.
I found something that "nearly" works:
I use the following annotations:
ingress.kubernetes.io/force-ssl-redirect: "true"
ingress.kubernetes.io/redirect-permanent: "true"
ingress.kubernetes.io/redirect-regex: ^https://(mydomain.io|www.mydomain.io)/?(.*)
ingress.kubernetes.io/redirect-replacement: https://mydomain.io/$2
ingress.kubernetes.io/ssl-host: mydomain.io
ingress.kubernetes.io/ssl-redirect: "true"
Expected behaviour would be:
https://www.mydomain.io -> https://mydomain.io
But I get this:
https://www.mydomain.io ->. https://www.mydomain.io. -> hit refresh -> https://mydomain.io
Which means opening the URL does not redirect from the first time, I need to perform a refresh (Cmd-R) in order to get redirected to the correct URL.
Any idea ? Or Traefik v2 would solve this issue more easily ?
Many thanks,
Hello @nowel.hermans,
your regex here:
ingress.kubernetes.io/redirect-regex: ^https://(mydomain.io|www.mydomain.io)/?(.*)
ingress.kubernetes.io/redirect-replacement: https://mydomain.io/$2
Looks like it matches https://mydomain.io/foo
and redirects it to https://mydomain.io/foo
, which browsers will probably not process immediately due to redirect loops.
Try using: ingress.kubernetes.io/redirect-regex: ^https://(www.mydomain.io)/?(.*)
instead, as it will only match on www.
Hello @daniel.tomcej ,
That fixed my issue ! And it make perfect sense to do it this way.
Many thanks for your help
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.