Forum Discussion
iRule to reselect pools using different health checks
Good day all,
Thanks in advance for your assistance. My customer asked me for a way to make it so that requests to a VIP will be broken out by different modules on the app platform and allow requests to go to a server which is healthy for that module and get reselected to a new vip when one goes down.
All traffic goes to the host https://app1.company.org/ and the requests are broken up by the beginning of the URI like /mod1/something mod2/something etc.
I'm currently just checking all the module specific health checks and allowing any 1 to keep the vip/pool up but they asked for something that would stay up for good modules while bad ones are marked down or attempted to reselect. It's complex enough that I'm not even sure if this is a good approach. Thanks for having a look
IRULE:
---
#this_file:prod-app1-pool-reselect
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/mod1*" { pool "prd-pl-app1-mod1" }
"/mod2*" { pool "prd-pl-app1-mod2" }
"/mod3*" { pool "prd-pl-app1-mod3" }
"/mod4*" {
log local0. "observed-app1-mod4"
pool "prd-pl-app1-all"
persist cookie insert
}
}
default { pool "prod-pl-app1-all" }
}
when HTTP_RESPONSE {
if { [HTTP::status] > "300" } {
LB::reselect pool
}
when LB_FAILED {
if { [active_members [LB::server pool]] > 0 } {
catch { LB::down }
LB::mode rr
LB::reselect
}
}
POOLS:
---
pool prd-pl-app1-all {
monitor all prd-app1-all
members {
172.20.123.1:https {}
172.20.123.1:https {}
}
}
pool prd-pl-app1-mod1 {
monitor all prd-app1-mod1
members {
172.20.123.1:https {}
172.20.123.1:https {}
}
}
pool prd-pl-app1-mod2 {
monitor all prd-app1-mod2
members {
172.20.123.1:https {}
172.20.123.1:https {}
}
}
pool prd-pl-app1-mod3 {
monitor all prd-app1-mod3
members {
172.20.123.1:https {}
172.20.123.1:https {}
}
}
Recent Discussions
Related Content
* 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