Forum Discussion
Chris_Minnich_1
Nimbostratus
Mar 27, 2007URL based redirect...
Hello...
I have 3 instances where I need certain URL's to be directed to a specific pool (the same pool), http://websitename/calendar, http://websitename/cgi-bin and http://websitename/smd/student/2008. Currently I have 3 separate iRules applied to the VS for each of these situations, all that look like the following, with the appropriate name following the /:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/smd/student/2008" } {
pool URMCPublicExclusion_HTTP_Pool
} else {
pool URMCPublic_http_Pool
}
}
Can I combine all 3 of these into one iRule? I am having issues with one of these iRules working prperly (one that I know of), and I was curious if it was related to having 3 sperate rules. Any help would be appreciated. Thanks!
Chris
- Chris_Minnich_1
Nimbostratus
I think I see why this is not working with 3 separate rules, so I took a crack at combining the 3....I know this is not the most efficient way, but hopefully I am on the right track. I am not a programmer and new to iRules, so please be gentle! - Chris_Minnich_1
Nimbostratus
I made one more change to the irule...learning as I go! - That should work for you, but you are doing a separate string allocation in each of the if/elseif's. If I were you, I'd go with the switch route (just my own preference. And since, you are using the same case for each of the conditions, a switch is extra-easy to read. Either way should work for you though. You pick what is easier for you to maintain.
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/calendar*" - "/smd/student/2008*" - "/cgi-bin*" { pool URMCPublicExclusion_HTTP_Pool } } }
http://tmml.sourceforge.net/doc/tcl/switch.html
Click here - Chris_Minnich_1
Nimbostratus
Thanks very much Joe!
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