Forum Discussion

Shlairshe_84486's avatar
Shlairshe_84486
Icon for Nimbostratus rankNimbostratus
Mar 21, 2015

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.