Forum Discussion
Kevin_Stewart
Jul 03, 2014Employee
While it's certainly a workable idea, I'd hesitate to use the after command, given that it has the potential to consume extra memory and that you'd be using it on every HTTP response. I think you might do well here with an inband monitor and an iRule like this:
when CLIENT_ACCEPTED {
set def_pool [LB::server pool]
set lb_fails 0
}
when LB_FAILED {
log local0. "lb failed"
if { $lb_fails < [active_members $def_pool] } {
LB::mode rr
LB::reselect pool $def_pool
} else {
log local0. "no servers available"
HTTP::redirect "http://www.google.com"
}
incr lb_fails
}
You'd normally combine this with an active monitor that proactively removes failed members from the pool, while the inband monitor and iRule waits some predetermined amount of time for a response before triggering an LB_FAILED event.