Forum Discussion
Joe_Curl_105786
Nimbostratus
Mar 31, 2010iRule Pool Selection
We have an iRule that we use to restrict access to only specific URI patterns. If the pattern is matched, then we select a pool. I was wondering if there is any way to tell it to select the pool that is tied to the specific VIP instead of creating this rule multiple times, and just changing the pool name. The pool name NRDC-PK-Mobility-QA-Pool is the name of the pool associated with the VIP. We are trying to make it more generic so we can use this single rule in many instances. Any assistance is appreciated. I have put an example of the rule below.
Joe
when HTTP_REQUEST {
if { ( [string tolower [HTTP::uri]] starts_with "/transportservlet" ) or ( [string tolower [HTTP::uri]] starts_with "/aliveservlet" ) } {
pool NRDC-PK-Mobility-QA-Pool
} else {
reject
}
}
1 Reply
- The_Bhattman
Nimbostratus
Hi Joe,
I think you can rewrite it to the following:when HTTP_REQUEST { From the client side context it's going to determine the VIP address it's connected to if {[IP::addr [IP::local_addr] eq "192.168.12.3" } { switch -glob [string tolower [HTTP::uri]] { "/transportservlet*" - "/aliveservlet*" { pool NRDC-PK-Mobility-QA-Pool } default { reject } } } }
I reworked the HTTP::uri evaluation to use SWITCH because it it's more efficient then IF-ELSE.
I hope this helps
Bhattman
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
