Ema
Aug 23, 2019Nimbostratus
Irule for www removal on https
I would like to remove the www from the url but is having some issues with the code on one of my vip.
I currently have 2 vips:
1 is for http redirection to https with that includes the www removal and no pools attached. This is working correctly.
My other vip which is just a https vip with a pool attach that is not working and this is the irule I have attached to it.
- when HTTP_REQUEST {
- if {[string tolower [HTTP::host]] starts_with "www."}{
- HTTP::redirect "https://[string map {www. ""} [string tolower [HTTP::host]]]"
- }
- }
So when I type in https://www.abc.company.com it is not redirecting for the HTTPS vip but when I use www.abc.company.com the HTTP vip redirects me to the correct url abc.company.com.
Thanks in advance for the help.
Hi,
Can you try this iRule in browser's incognito mode?
when HTTP_REQUEST { if {[string tolower [HTTP::host]] starts_with "www."}{ log local0. "hostname = [HTTP::host]" HTTP::redirect "https://[substr [HTTP::host] 4][HTTP::uri]" } }