Forum Discussion
pzinsou_74089
Nimbostratus
Aug 29, 2007irule optimization - redirect based on URL
Hello, this is my irule.
I need to know how to optimize it. Is there any max number of "contains" conditions for the if. Or can I add many number of site to redirect?
Can I add many many site or s...
Aug 29, 2007
Your iRule is fine as long as your list of sites doesn't grow too large. There is no physical limit to the number of contains you can use, but by joining many "or" operators together in a single if statement, you'll eventually suffer a slight performance degredatation. Data Groups are one option and another option is to use a switch statement.
when HTTP_REQUEST {
set Client_IP [clientside {IP::remote_addr}]
if { [IP::addr $Client_IP equals "141.227.1.2"] } {
log local0. "c'est le proxy1"
switch -glob [HTTP::host] {
"*yahoo*" -
"*bred*" {
pool POOL_SURFING
log local0. "on utilise le pool POOL_SURFING"
}
default {
pool POOL_ISP
log local0. "on utilise le pool ISP"
}
}
} else {
pool POOL_ISP
log local0. "on utilise le pool ISP"
}
}
I'd recommend you take a look at the "How to write fast iRules" document over in the wiki
http://devcentral.f5.com/wiki/default.aspx/iRules/HowToWriteFastRules.html
Click here-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