Forum Discussion
Geir_Sandbu_342
Nimbostratus
Sep 04, 2009add www to a https host
One of our customers uses a certificate for his website. The certificate is assigned to https://www.customer.com.
So when somebody types https://customer.com as the URL, they get a cert...
Sep 04, 2009
That's actually very simple to do. Apply this iRule to their Virtual server and they should be all set.
when HTTP_REQUEST {
if { !([string tolower [HTTP::host]] starts_with "www.") } {
HTTP::redirect http://www.[HTTP::host][HTTP::uri]"
}
} This will essentially check the value of the Host header and if it doesn't start with "www." it will issue a HTTP redirect to the client browser with www. added to the beginning of the URI.
If the customer doesn't want to do this for all requests, but only for the single domain "customer.com", you could do something like this:
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] eq "customer.com" } {
HTTP::redirect "http://www.customer.com[HTTP::uri]"
}
} Hope this helps...
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
