Forum Discussion
mister_65355
Nimbostratus
Jun 19, 2007limited Web
Hi All,
I will like limited the accesses Web only for http://@IP_serveur/test/ (for example only for /test/ and /test2/)
What I can make?
Thanks
Jul 24, 2007
Your iRule is probably as optimized as you are going to get it. There are several ways you can write a iRule like this. One of them is with if/elseif's like you have it. If you want to optimize the way it is, then you'll need to look at patterns as to which URI's occur most often and move them up higher in the set of elseif's. But if you don't have that information, this is likely the best you can get.
With that said, since all of your elseif's are comparing the same value (HTTP::uri), then you can replace that section with a switch statement which is higher performing than if/elseifs. Something like this:
when HTTP_REQUEST {
if { [HTTP::host] == "app.example.com"}{
pool Pool1
} else {
switch -glob [HTTP::uri] {
"*/test/*" -
"*/info/*" -
"*/test1/*" -
"*/test2/*" {
pool Pool1
}
default {
reject
}
}
}
}These two iRules should be functionally equivalent though.
Hope this helps...
-Joe
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