Forum Discussion
Wil_Schultz_101
Nimbostratus
Jul 30, 2007Reselect pool on status code 500 or above...
So we run some Tomcat servers, when we undeploy the server will send a 503 that states that the application is unavailable. I do have a check that looks for a static page every 5 seconds and fails at 16 seconds, however for that 16 second period people from the outside world see this 503 error.
I would like to set it up to where any status code above 500 reselects but I seem to have an order of operation problem. Maybe someone that i saner than I might have a suggestion?
Here is what I have so far:
when HTTP_RESPONSE {
if { [HTTP::status] > 499 }{
set ::hostfailed 1
log local0. "Setting up ::hostfailed."
}
}
when LB_SELECTED {
if { $::hostfailed == 1 } {
LB::detach
LB::reselect [LB::server pool]
log local0. "LB failed, re-load balancing to pool."
}
}
This irule fails because LB_SELECTED us called after HTTP_RESPONSE and ::hostfailed is not set.
- JRahm
Admin
Have you considered HTTP::retry? This requires at least 9.2. - Andy_Herrman_22
Nimbostratus
I'm pretty sure Selected happens before Response. The Selected event triggers when the member the request will be forwarded to is picked. No response can come until after that's done. - Wil_Schultz_101
Nimbostratus
I can verify that the select takes place before the response :-) - Deb_Allen_18Historic F5 AccountLooks good, but I'd change this:
to this:if {!($myretry >= 3) } {
just because your way turns my brain inside out...if {$myretry < 3} {
- Arie
Altostratus
It looks like the iRule is detecting the 5xx properly, but the redirect seems to be in a loop (calling the same node) until the browser gives up. - Colin_Walker_12Historic F5 AccountAre you saying you've tried this and are having issues? It sounds to me like it was working for the OP.
- Arie
Altostratus
That's right. I copied the iRule from the post and made the suggested change. - Arie
Altostratus
I've plugged in the new version of the iRule, but I'm still getting the same results (infinite redirects). Seems to happen in the first part (HTTP::retry), not at the HTTP::redirect. - Wil_Schultz_101
Nimbostratus
what does /var/log/ltm say? - Arie
Altostratus
Unfortunately my access level does not allow me to utilize Big-Pipe. Would this information be logged in the log the GUI can access?
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