Forum Discussion
Moinul_Rony
Altostratus
Sep 19, 2013iRule to catch 4XX and 5XX HTTP error codes.
Hi,
Is there any way to catch all 4XX and 5XX http error codes rather then specifying individually ie. 404, 500, 400 etc ?
I am trying to set a friendly error page response to client when the se...
Richard__Harlan
Sep 19, 2013Historic F5 Account
Here is what I have used in the past to have the LTM try all members in the pool on a 4xx or 5xx status code. It could be easy updated to do what you want
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]
}
}
Moinul_Rony
Altostratus
Sep 19, 2013Thanks Richard, That really helps. How do you log the original responses using "log local0.info " ?
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