Forum Discussion
scottl_82413
Nimbostratus
Feb 07, 2008Don't redirect to SSL if URI exists
I'm trying to create an irule that will redirect:
http://www.mysite.com to https://www.mysite.com
however, if someone goes to http://www.mysite.com/training
I don't want ...
hoolio
Cirrostratus
Feb 07, 2008Sorry...typing faster than thinking. You do need quotes for the comparison.
Can you log the URI before testing if it's literally "/training"? I would imagine that either the client is requesting a mixed case of training, the URI is longer than just "/training", the URI is fully qualified with the hostname, or the app itself is sending the redirect.
Here is a version with additional logging to /var/log/ltm:
when HTTP_REQUEST {
log local0. "Client [IP::client_addr] requested [HTTP::host][HTTP::uri]"
Check if requested path isn't /training
if {not ([HTTP::path] eq "/training")}{
log local0. "Redirecting client [IP::client_addr] from [HTTP::path] to [HTTP::host][HTTP::uri]"
Redirect request to the same host/uri, but via 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