Forum Discussion
spud_141786
Sep 30, 2014Nimbostratus
These error may be transient so marking a server down may not be ideal. The following iRule was suggested for a similar request here https://devcentral.f5.com/questions/irule-to-catch-4xx-and-5xx-http-error-codes:
when CLIENT_ACCEPTED {
set retry 0
}
when HTTP_REQUEST {
set http_request [HTTP::request]
}
when HTTP_RESPONSE {
if { ([HTTP::status] starts_with "4") || ([HTTP::status] starts_with "5")} {
incr retry
if { $retry <= [active_members [LB::server pool]] } {
HTTP::retry $http_request
} else {
set retry 0
}
} else {
set retry 0
}
}
when LB_SELECTED {
log local0.info "Run $retry";
if { ($retry > 0) && ($retry <= [active_members [LB::server pool]])} {
LB::reselect pool [LB::server pool]
}
}