Forum Discussion
Jason_48455
Nimbostratus
Jun 30, 2008HTTP to HTTPS redirect on non-standard port
I have a web application that is running on a non-standard port. We need to have SSL on it. I applied the client certificate and https works fine, but if we enter http we get a page cannot be displa...
hoolio
Cirrostratus
Jun 30, 2008If the request can be HTTP or HTTPS on the same port, you can track whether there was a client SSL handshake using the CLIENTSSL_HANDSHAKE event and only send a redirect for requests which didn't initiate a n SSL handshake. Because the port stays the same, you can redirect to the same host (including the port) and URI.
when CLIENT_ACCEPTED {
Set a variable to track whether this is an HTTPS request
set https 0
}
when CLIENTSSL_HANDSHAKE {
There was a client side SSL handshake, so update the variable
set https 1
}
when HTTP_REQUEST {
If it's not an HTTPS connection, send a redirect
if {not ($https)}{
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}
Aaron
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