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 certificate error. I need to change the HTTPS request from https://customer.com to https://www.customer.com.
This is probably done by a simple irule, but I am not able to find a solution to this. I have also searched this forum after something that could help me on the way, but nothing so far.
Can anyone please help?
Thanks.
- 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]" } }
when HTTP_REQUEST { if { [string tolower [HTTP::host]] eq "customer.com" } { HTTP::redirect "http://www.customer.com[HTTP::uri]" } }
- The_Bhattman
Nimbostratus
I wanted to add the SSL handshake will occurbefore any iRule is processed, which means that the customer's clients will receive cert err before the redirection occurs. This is more or less a limitation of SSL Traffic. - hoolio
Cirrostratus
If you're able to redirect the HTTP request from http://customer.com to https://www.customer.com, then you'll avoid the mismatched cert warning. Else, you might be able to get a UCC SSL certificate which is valid for customer.com and www.customer.com. In that case, you wouldn't need an iRule. - Geir_Sandbu_342
Nimbostratus
Thanks for the quick replies folks. - hoolio
Cirrostratus
In order to parse, inspect or modify the HTTP content in an HTTPS request, you'll need to decrypt the SSL using a client SSL profile. If you want to use native HTTP:: iRule commands, you'll need to add an HTTP profile. See my last post on two possible solutions for avoiding the cert mismatch error.
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