Forum Discussion
Skuba_85554
Nimbostratus
Jun 05, 2009is this irule ok?!
i've used the irule editor to check but it doesn't seem to be working correctly i.e. www.mainsite.com doesn't work but www.mainsite.com/subsite does work!...
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/subsite" or "/subsites"} {
pool subsite_pool
}
else {
pool main_pool
}
}
the previous irule worked fine but didn't do everything we needed...
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/subsite"} {
pool subsite_pool
}
else {
pool main_pool
}
}
this has knocked out one of our production web sites so i'd appreciate any input
many thanks
2 Replies
- Skuba_85554
Nimbostratus
i think i've solved it with the following irule...
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/subsite"} {
pool subsite_pool
}
elseif { [string tolower [HTTP::uri]] starts_with "/subsites"} {
pool subsite_pool
}
else {pool main_pool}
} - Colin_Walker_12Historic F5 AccountYou were close with your initial attempt. Whenever you're using a logical operator like or, you have to repeat the comparison operator as well. Like this:
when HTTP_REQUEST { if { ([string tolower [HTTP::uri]] starts_with "/subsite") or ([string tolower [HTTP::uri]] starts_with "/subsites")} { pool subsite_pool } else { pool main_pool } }
Realistically though, starts_with /subsite includes starts_with /subsites anyway, so you should only need the one comparison.
So really, this should get you there:when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/subsite"} { pool subsite_pool } else { pool main_pool } }
hth,
Colin
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