Forum Discussion
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?
- nitassEmployeeBut didn't work for https .Whats wrong behind this?it is an expected behavior since SSL handshake has to be done before triggering HTTP_REQUEST event.
- ArieAltostratusThe only way to make this work is to either get another cert (for www.domain.com) or to use a wildcard cert (*.domain.com).
- hooleylistCirrostratusOne option would be to change the DNS so that example.com and www.example.com resolve to separate IP addresses. You could then use one cert for each separate domain and redirect as you want after the SSL decryption has completed. Or you could get a single SAN cert valid for both example.com and www.example.com and use a single IP address.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects