Hi, I need an irule which catches 404s returned from a server pool and re-directs to a friendly page. when HTTP_RESPONSE { if { [HTTP::status] == 404} { HTTP::respond “http://www..test.com/pagenotfound” } } My problem is the pagenotfound returns a 404 status code so it has created a loop. Any advice on the best way to proceed I have done some searching but haven’t found an irule which matches what I need to do. Cheers.
As Chris said, the 404 handler page shouldn’t return a 404 itself. Though if this is something you can to implement and you can’t change the status, you could save the URI in HTTP_REQUEST and then not redirect to the 404 page if the request is for it already.
when HTTP_REQUEST {
set uri [HTTP::uri]
}
when HTTP_RESPONSE {
if { [HTTP::status] == 404 and $uri ne "/404.html"} {
HTTP::redirect "http://www.example.com/404.html"
}
}
Aaron