Forum Discussion

F5nubster_10260's avatar
F5nubster_10260
Icon for Nimbostratus rankNimbostratus
Dec 09, 2008

HTTPS to HTTPS redirect

Hi,

 

 

I currently have a virtual server for 123.abc.com with HTTP and HTTPS.

 

 

when a request is sent for http://123.abc.com I use the following iRule to redirect the traffic to the virtual server for https://123.abc.com:

 

 

Virtual Server 123.abc.com HTTP iRule:

 

when HTTP_REQUEST {

 

 

if { [TCP::local_port] == 80 }{

 

if { [HTTP::host] equals "123.abc.com" } {

 

HTTP::respond 301 Location "https://123.abc.com"

 

} elseif { [HTTP::host] equals "234.abc.com" } {

 

HTTP::respond 301 Location "https://123.abc.com"

 

} elseif { [HTTP::host] equals "345.abc.com" } {

 

HTTP::respond 301 Location "https://123.abc.com"

 

} else {

 

HTTP::respond 301 Location "https://[getfield [HTTP::host] : 1][HTTP::uri]"

 

}

 

}

 

}

 

 

This works as intended without a problem.

 

 

Here is my problemo....

 

 

My company owns 234.abc.com and 345.abc.com as well which are just different names for the same site. The SSL cert that we have contains the site name 123.abc.com only. Here is the iRule that I use for the redirects.

 

 

Virtual Server 123.abc.com HTTPS iRule:

 

when HTTP_REQUEST {

 

 

if { [TCP::local_port] == 443 }{

 

if { [HTTP::host] equals "234.abc.com" } {

 

HTTP::respond 301 Location "https://123.abc.com"

 

} elseif { [HTTP::host] equals "345.abc.com" } {

 

HTTP::respond 301 Location "https://123.abc.com"

 

}

 

}

 

}

 

 

So when a request is made to https://234.abc.com the redirect works fine but I get the ssl error stating:

 

 

"The name on the security certificat is invalid or does not match the name of the site"

 

 

Is there any way around this?

 

 

Any help will be greatly appreciated.