Forum Discussion
DM_5174
Mar 11, 2011Nimbostratus
independant from case-sensitive URI path httpS redirect
Hi All,
I was wondering if I could get some help from all of the i-rule gurus here.
Below is an i-rule we have that will 1) add "www" to the URI if a user forgets to put it in, and
2) if the user specify "/Mgt/Portal/LogOn" in the URI (for example http://www.abc.test.com/Mgt/Portal/LogOn" they will get redirected to HTTPS "httpS://www.abc.test.com/Mgt/Portal/LogOn".
Currently we only want to trigger this because by default site www.abc.com should NOT be HTTPS.
1. Is there a way to make it where if the the path "/Mgt/Portal/LogOn" can independant from case-sensitive charaters? So if the user puts /MgT/porTal/login" you still get HTTPS
2. And also consolidate this into a effcient irule and not use two "if" statment?
Thanks all in advance!
-DM
when HTTP_REQUEST {
if { [HTTP::host] equals "abc.test.com" } {
HTTP::redirect "http://www.abc.test.com[HTTP::uri]"
}
if { [HTTP::path] equals "/Mgt/Portal/LogOn" } {
HTTP::redirect "https://www.abc.test.com[HTTP::uri]"
}
- Chris_MillerAltostratus1. Use "string tolower" before whatever you're trying to check.
when HTTP_REQUEST { if { [HTTP::host] eq "abc.test.com" } { HTTP::redirect "http://www.abc.test.com[HTTP::uri]" } elseif { [string tolower [HTTP::uri]] starts_with "/mgt/portal/login" } { HTTP::redirect "https://www.abc.test.com[HTTP::uri]" } }
- DM_5174NimbostratusHi Chris,
- hooleylistCirrostratusThat looks good to me Chris :)
- Chris_MillerAltostratusTry this:
when HTTP_REQUEST { if { [HTTP::host] eq "abc.test.com" } { HTTP::redirect "http://www.abc.test.com[HTTP::uri]" } elseif { [string tolower [HTTP::uri]] starts_with "/mgt/portal/login" } { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } }
- Chris_MillerAltostratusWait - are you saying someone who puts in abc.test.com/abc isn't being redirected to www.abc.test.com/abc ?
- I think I see what He's looking for..
- Chris_MillerAltostratusDM - can you confirm iRuleYou is describing what you want to see? I guess we could do some sort of string map for this.
- DM_5174NimbostratusHey Guys,
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