Suresh_89060
Dec 29, 2011Nimbostratus
IRule to remove www. from Host
My domain is example.com and uses for web service both https/http
Certificate has taken for CN example.com.Then If HTTPS, my cert is only valid for example.com and when client requests www.example.com gives a cert mismatch warning.
So i use this irule for redirection.
HTTP
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] starts_with "www."}{
HTTP::redirect "http://[string range [HTTP::host] 4 end][HTTP::uri]"
}
}
HTTPS
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] starts_with "www."}{
HTTP::redirect "https://[string range [HTTP::host] 4 end][HTTP::uri]"
}
}
But this works for http.But didn't work for https .Whats wrong behind this?