dan_19334
Dec 20, 2010Nimbostratus
determine HTTP or HTTPS
What is the best way to determine if the connection came in HTTP or HTTPS? I want to have a common iRule applied to both port 80 & 443 that redirects the connection to a different location but keeps it HTTP or HTTPS depending on how it came in.
when HTTP_REQUEST {
if { "CAME IN WITH SSL?" } {
HTTP::redirect "https://abc123.com[HTTP::uri]"
} else {
HTTP::redirect "http://abc123.com[HTTP::uri]"
}
}
Is there an efficient way to do this?
Thanks,
-Dan
Patrik, good one. You have typo. It should be:
if { [PROFILE::exists clientssl] == 1 } { set protocol "https" } else { set protocol "http" }
I'm doing this on CLIENT_ACCEPTED. The method with CLIENTSSL_HANDSHAKE will not work because BIG-IP refuse to load it on VS without SSL profile.