Forum Discussion
Don_22992
Nimbostratus
Apr 02, 2008stubborn 4xx/5xx Error Handler
I am sure this is simple....
I have the following iRule to redirect 4xx & 5xx errors to a page on a backend server. It works great - once I have sucessfully connected to the site once! What ...
hoolio
Cirrostratus
Apr 03, 2008Can you clarify this? If the pool member responds with a 4xx or 5xx status, the first response still gets through to the client but any subsequent response is redirected? Is that what you mean?
Can you add logging to the rule to check this?
when HTTP_REQUEST {
set myhost [HTTP::host]
}
when HTTP_RESPONSE {
log local0. "[IP::client_addr]:[TCP::client_port]: Request $myhost generated response status: [HTTP::status]"
if { ([HTTP::status] starts_with "4")} {
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to 4xx.htm"
HTTP::redirect https://$myhost/images/errors/err_4xx.htm
} elseif { ([HTTP::status] starts_with "5")} {
log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to 5xx.htm"
HTTP::redirect https://$myhost/images/errors/err_5xx.htm
} else {
log local0. "[IP::client_addr]:[TCP::client_port]: Doing nothing"
}
}You can check the log output by tailing the ltm log file (tail -f /var/log/ltm).
Aaron
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
