Forum Discussion
crodriguez
Mar 13, 2020Ret. Employee
You can also reference K6510: BIG-IP system fallback host behavior when a host is down for information on using Fallback Host in the associated HTTP profile. It provides an alternative that does not include iRules, which is more efficient, but comes with some caveats. It also shows an iRule that triggers on LB_FAILED rather than HTTP_REQUEST, which is far more efficient since HTTP_REQUEST is triggered for every request, while LB_FAILED is only triggered if there is a problem with establishing the server-side connection, such as no available pool members. Here's the iRule code from that article that redirects the request to an apology server. (Instead of HTTP::fallback, you could do your HTTP::respond 503.):
when LB_FAILED {
if { [active_members [LB::server pool]] < 1 } {
# The redirect will be sent only if LB_FAILED
# was because the pool had no available members.
HTTP::fallback "http://example.com/redirect.html"
}
}