Forum Discussion
aschi
Nimbostratus
Mar 06, 2013https to http redirect
Hello
I have the following Problem.
What ist running at the moment:
->
->
->
Every Request to the "url", even on Port 80 must be redirected to https.
We have...
Michael_Yates
Nimbostratus
Mar 06, 2013Hi aschi,
You could solve your problem with httpclass Profiles or iRules, do you have a preference?
iRule Method:
On your HTTP Virtual Server, modify your HTTP to HTTPS Redirect iRule to look at the [HTTP::uri] before it takes any action. If "/uri1" redirect, if "/uri2" or "/uri3" send to the server pools for each.
On your HTTPS Virtual Server, apply the reverse logic of the previous iRule.
If you want to combine them into a single iRule you can do that as well using the "if {[TCP::local_port] == 443 }" approach and separate the logic. Also, make sure you have a default action (I assume that you would want the default action to perform an HTTP to HTTPS redirect to somewhere).
httpclass Method:
Each httpclass can match on the Host and/or URI Value. You can create the same type of logic used in the iRules to serve the same purpose.
httpclass1 = On HTTP Virtual Server detect "/uri1" and perform a redirect.
httpclass2 = On HTTPS Virtual Server detect "/uri2" and redirect to HTTP.
httpclass3 = On HTTPS Virtual Server detect "/uri3" and redirect to HTTP.
You could create a final httpclass to apply on your HTTP Virtual Server to perform a generic HTTP to HTTPS Redirect (just make sure it is the final httpclass in the stack (once an httpclass matches it will process the request and not process any further httpclasses).
Hope this helps.
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