Forum Discussion
Rob_Wotton_8024
Nimbostratus
Oct 20, 2009Pool redirection and healthcheck
Hi,
I have been banging my head against the wall for the past couple of days with this one, so any help would be greatly appreciated.
We need to redirect certain URL's to a specific pool, however, we would also like to include a health check against that pool and the pool is down use a different pool.
Below is my attempt at the rule, but as you can probably tell it doesn’t work. Can anyone offer some help?
Many thanks
Rob
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if {{ $uri starts_with "/sitea " } and {[active_members webpool-1]}}
{
pool webpool-1
}
elseif { $uri starts_with "/site1" }
{
pool webpool-2
}
elseif {{ $uri starts_with "/siteb" } and {[active_members webpool-1]}}
{
pool webpool-1
}
elseif { $uri starts_with "/siteb" }
{
pool webpool-2
}
else {
if {[active_members defaultpool-1]} {
pool defaultpool-1
}
else {
pool defaultpool-2
}
}
}
1 Reply
- hoolio
Cirrostratus
If you use a two pool approach, you would probably want to also check if the second pool has active members before using it. And then you'd want to handle the case where both pools are down.
It might be easier to use a single pool for each app and add the second set of servers at a lower priority in the same pool. LTM would automatically use the second set of pool members if no higher priority member was available.
Either way, you could use switch to do this a bit more efficiently:when HTTP_REQUEST { Check requested URI switch [string tolower [HTTP::uri]] { "/sitea" { pool webpool-1 } "/siteb" { pool webpool-2 } default { pool webpool-2 } } }
If you run into problems with this rule or your own version, try adding logging to each code section and check the /var/log/ltm output to see what portions of the rule are being hit.
Aaron
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