I would like to craft an iRule that detects the pool assigned to the VIP has all members down. When it is down then do an http redirect to our site down web server. I have rules in place where I call a specific pool in the rule, but I would like to make it more generic so that I can apply it to any VIP without having a rule for every VIP. I posted an example of what we have been doing up to this point. Thanks.
when HTTP_REQUEST { if { [active_members RSAGA-Juniper-Pool-Prod] < 1 or [active_members RSAGA-Juniper-Radius-Pool-Prod] < 1 } { HTTP::redirect “http://frdcsd.app.medcity.net/vdi/” }
thats nice. Till today, I did it on the same way like Joe.
Additional question:
If I put this in a seperate irule and respond with a HTTP::respond instead of an HTTP::redirect, do I need to add a priority tag to the HTTP_request and and an event deisable behind?
i.e.:
one global irule for availability check
when HTTP_REQUEST priority 999 {
if { [active_members [LB::server pool]] < 1 } {
HTTP::respond 503 "Server is down"
event disable all
return
}
}
If I put this in a seperate irule and respond with a HTTP::respond instead of an HTTP::redirect, do I need to add a priority tag to the HTTP_request and and an event disable behind?
i would do to ensure there is no conflict (e.g. multiple redirects). please be noted that event will be disabled throughout the connection or until event is re-enabled.
If I put this in a seperate irule and respond with a HTTP::respond instead of an HTTP::redirect, do I need to add a priority tag to the HTTP_request and and an event disable behind?
i would do to ensure there is no conflict (e.g. multiple redirects). please be noted that event will be disabled throughout the connection or until event is re-enabled.
it catches when the pool is down (no active members) and also when the pool has not been marked down, but the pool member chosen is unresponsive, so it’s actually more powerful than just checking [active_members [LB::server pool]]
it’s slightly more efficient as it saves potentially unnecessary checking in HTTP_REQUEST and you wouldn’t need to worry about event disabling in HTTP_REQUEST (assuming you do not implement LB_FAILED in your other iRules) - this may not be a concern but worth noting
There may be other situation-specific reasons for wanting to execute the check in HTTP_REQUEST but if not LB_FAILED works well too as a generic rule for catching errors.
If doing a 302 redirect to a sorry page though as the original asker wanted, this would not be a problem.
Having said that…I think you’ve just directed me to a solution I needed!! I have seen this behaviour when trying to return large pages with embedded content to the client and was meaning to raise a case (but now don’t need to).
if you do a lot of irule stuff, I would say, it is more efficient to check for a reachable backend before. So you can save some resources on f5. Especially, if you running ASM, too.
So, the request will be blocked at the beginning and will not run through a security policy before it get an redirect. But Im not 100% shure, if the security policies comes before LB_FAILED. I didn’t find a picture over all the events, only this nice one: