Forum Discussion
Need an opinion on the best way to handle multiple http to https redirects for URI with a single irule scriprt
Below is the irule I have working (v 11.4)
when HTTP_REQUEST { set req [string tolower [HTTP::uri]] if { $req starts_with "/artic"
} {HTTP::redirect "https://[HTTP::host][HTTP::uri]"} use pool toplevel1 if { $req starts_with "/ports"} { HTTP::redirect "" } }
The above i-Rule works fine,
--- > when I access the url http://darten.seng.tts.com/artic I reach the desired site and the http to https redirect works.
--- > The same applies to when I access the url http://darten.seng.tts.com/ports, I get redirect to the server1:8080/TOE/BOC url.
My problem is. I am adding two more URI'S and i need to have each URI reachable via https from http.
THIS IS WHAT I HAVE PREPARED :
when HTTP_REQUEST { set req [string tolower [HTTP::uri]] if { $req starts_with "/artic" } HTTP::redirect "https://[HTTP::host][HTTP::uri]" use pool toplevel1 if { $req starts_with "/extartic1" } HTTP::redirect "https://[HTTP::host][HTTP::uri]" use pool retop if { $req starts_with "/ports" } HTTP::redirect "" use pool Porting_Pool }
In effect, for eact /uri --> /artic, /extartic1 and /ports, I want to be able to be redirected from http to https. To clearly explain
--- > When a user accesses http://darten.seng.tts.com/artic --- > I want to be able to get to this site/uri ending in https://darten.seng.tts.com/artic (going from http to https)
--- > Whe a user accesses http://darten.seng.tts.com/extartic1 --- > I want to be able to get to the site/uri executing to https://darten.seng.tts.com/extartic1 (going from http to https)
--- > when a user enters http://darten.seng.tts.com/port --- > I want to be able to get to the site/uri executing to https://darten.seng.tts.com/ports (going from http to https)
Really need some help.
1 Reply
- nitass
Employee
have you seen suggestion from Stephan?
Assistance with multiple instance i-Rule using multiple http to https redirect
https://devcentral.f5.com/questions/assistance-with-multiple-instance-i-rule-using-multiple-http-to-https-redirect
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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