Forum Discussion
Chris_103315
Nimbostratus
Mar 04, 2008HTTP_REQUEST event bypassed?
I'm writing an iRule in our production environment to split traffic based on URI. All works fine except there is one request that seemingly doesn't fall into any case and is in turn load-balanced betw...
Mar 04, 2008
Had to chime in. Duplicating "string tolower" on each of the if/elseif's is way too much overhead. I'd go with something like this:
when HTTP_REQUEST {
log local0. "uri is [HTTP::uri]"
switch -glob [string tolower [HTTP::uri]] {
"/forums/*" {
log local0. "POOL01_03 used"
pool POOL01_03
}
"/account/*" {
log local0. "POOL04_06 used"
pool POOL04_06
}
"/api/*" {
log local0. "POOLAPI used"
pool POOLAPI
}
default {
log local0. "default pool POOL07_09 used"
pool POOL07_09
}
}
}
This uses no local variables an only has one string conversion.
-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