Retry 40x/50x errors¶
Contributed by: Richard Harlan¶
Description¶
This iRule will catch 40x/50x errors and retry each member of the Pool
until the servers respond with a non error event or each member of the
pool is tried.
iRule Source¶
# Retry 400/500 Errors
# CPU impact: Low
# Requirement: HTTP profile
#
# When a 400/500 is returned from the server the LTM will try
# resending to request to every member in the pool. Any time a
# request is retry the LTM will clear out the retry variable after
# the count has gone over the limit, or when a non 400/500 status is return
# This will allow the next request to be able to use the resend iRule also.
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]
}
}
The BIG-IP API Reference documentation contains community-contributed content. F5 does not monitor or control community code contributions. We make no guarantees or warranties regarding the available code, and it may contain errors, defects, bugs, inaccuracies, or security vulnerabilities. Your access to and use of any code available in the BIG-IP API reference guides is solely at your own risk.