Forum Discussion
Jeff_Morrison_4
Dec 05, 2007Nimbostratus
Combine iRules
When I try and combine these 2 rules into one, the second half of the rule (elseif) doesn't seem to work properly. I have the rules listed seperately on the VIP, but I have 40 rules and would like to combine them into one rule to administor.
1st rule:
when HTTP_REQUEST {
if { [HTTP::uri] contains "/ABC"
}{
pool WLS-V10
} elseif { [HTTP::uri] contains "/XX3333"}{
HTTP::uri [string map {/XX3333/ /ABC/} [HTTP::uri]]
pool WLS-V10
}}
2nd Rule:
when HTTP_REQUEST {
if { [HTTP::uri] contains "/DEF"
}{
pool WLS-V10
} elseif { [HTTP::uri] contains "/XX4279"}{
HTTP::uri [string map {/XX4279/ /DEF/} [HTTP::uri]]
pool WLS-V10
}}
Thanks for help in advance.
Jeff
- Colin_Walker_12Historic F5 AccountCombined, those would look something like:
when HTTP_REQUEST { if { ([HTTP::uri] contains "/ABC") or ([HTTP::uri] contains "/DEF") } { pool WLS-V10 } elseif { [HTTP::uri] contains "/XX3333"}{ HTTP::uri [string map {/XX3333/ /ABC/} [HTTP::uri]] pool WLS-V10 } elseif { [HTTP::uri] contains "/XX4279"}{ HTTP::uri [string map {/XX4279/ /DEF/} [HTTP::uri]] pool WLS-V10 } }
- hooleylistCirrostratusHi Jeff,
when HTTP_REQUEST { log local0. "Client [IP::client_addr] requested [HTTP::host][HTTP::uri]" switch -glob [HTTP::uri] { */ABC* - */DEF* { log local0. "Client [IP::client_addr] matched first case, sending to pool WLS-V10." pool WLS-V10 } */XX3333* { log local0. "Client [IP::client_addr] matched second case, rewriting URI to /ABC/, sending to pool WLS-V10." HTTP::uri [string map {/XX3333/ /ABC/} [HTTP::uri]] pool WLC-V10 } */XX4279* { log local0. "Client [IP::client_addr] matched third case, rewriting URI to /ABC/, sending to pool WLS-V10." HTTP::uri [string map {/XX4279/ /ABC/} [HTTP::uri]] pool WLC-V10 } default { log local0. "Client [IP::client_addr] didn't match any case." } } }
- Jeff_Morrison_4NimbostratusThanks Colin and Aaron. On my next maintenance window I will try both of these rules.
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