Chris_Miller
Jun 28, 2010Altostratus
Bit of Trouble iRule Logic
I have an iRule that handles persistence but also want to add logic that allows certain IPs to hit specific directories.
I've defined a datagroup with the addresses that can hit these specific directories...
Here's a basic rundown of my requirements:
1. Users who match my whitelist and specify a URI that contains 1A1 or 1A2 get sent to that pool.
2. Users who don't match my whitelist but specify a URI are passed through to the site but the switch/glob doesn't touch them.
3. Users who don't match my whitelist and don't specify a path are passed through and hit subsequent iRule text
Here's my rule:
if { ([HTTP::header "True-Client-IP"] or [IP::addr[IP::client_addr]] eq $::whitelist)} {
switch -glob [HTTP::uri] {
"*1A1*" { pool 1A1 }
"*1A2*" { pool 1A2 }
}
}
I have no problem with this being its own iRule and applying it to my VS, but if I do that, I'm unsure of how to close my "if" statement - I obviously don't want to reject them because if I'm understanding correctly, that will reject them if they don't meet both of the conditions above...