Forum Discussion
Randy_Johnson_1
Nimbostratus
Feb 08, 2006Newbie to IRules - HELP PLEASE !
Hi group -
This is my first venture into the world of IRules, and I'm hoping for some direction.
The basic situation is this -
I have a webfarm runing several applications. Some of these applications, we get paid for, and one we do not. The one app we don't get paid for is processor intensive, so I'd like to redirect requests for this app to a single machine in the farm.
My apps are all called via HTTPS, and the SSL connection is terminated at the BigIP.
Can I use something as simple as
when HTTP_REQUEST {
if { [HTTP::uri] contains "AddressSvc" } {
pool address_pool
}
}
And the BigIP will know what to do with the request if it does NOT contain the string
AddressSvc"AddressSvc"?
Or do I need 'Else' cases as well ? This would make the IRule considerably more ... painful, as there are MANY 'good' URLs that may be directed to any of several pools
Thanks, all !!
- You can leave it at that as long as all your other urls are going to a single pool. If you need to filter out more urls to different pools (as it seems from your post), then you'll have to account for them in the rule (or use multiple virtuals with a single pool on each).
- Then it really is as simple as you thought. You might want to force the uri to lower case to handle "address", "Address", "ADDRESS", etc though...
when HTTP_REQUEST { if { [string tolower [HTTP::uri]] contains "address" } { pool address_pool } }
- Randy_Johnson_1
Nimbostratus
Very good ! - Colin_Walker_12Historic F5 AccountThat's correct, the pool command takes an argument that is either a literal pool name, or a variable with a value that is the name of a valid pool.
- Randy_Johnson_1
Nimbostratus
Okay then, looks like I'm set... I'd like to log this stuff too... how does this look ? - Colin_Walker_12Historic F5 AccountThat looks really close. I'd make one small change and move the pool command to its own line, like this:
when HTTP_REQUEST { log local0. "checking URI for Address validation only calls" if { [string tolower [HTTP::uri]] contains "addresssvc.asmx" } { log local0. "Request from [IP::client_addr] is being sent to the Address Service" pool address_pool } }
- Randy_Johnson_1
Nimbostratus
LOL
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