Forum Discussion
bilal_01_143886
Nimbostratus
Sep 18, 2014Redirect traffic to other pool member if other sends http error code 502, 503 and 504
Hi,
I need to redirect traffic to other pool member if second member sends an http error code 502,503 and 504. Please suggest the most appropriate solution.
spud_141786
Nimbostratus
Sep 30, 2014These 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]
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
