Moinul_Rony
Sep 19, 2013Altostratus
iRule 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 server is sending a 4XX or 5XX HTTP response.
Currently I have the following which creates a generic html. Is there any way F5 can show a customized HTML or JSP page in reposnse?
Appreciate your assistance.. 🙂
when HTTP_REQUEST {
set hostvar [HTTP::host]
set urivar [HTTP::uri]
set delay 4 }
when HTTP_RESPONSE {
if { [HTTP::status] == 404 } {
HTTP::respond 200 content " Unfortunately, your request for ${hostvar}${urivar} casued a error. After 4 seconds, you’ll automatically be redirected to our home page. Sorry for this inconvenience. " "Content-Type" "text/html" }
if { [HTTP::status] == 500 } {
HTTP::respond 200 content " Unfortunately, your request for ${hostvar}${urivar} casued a error. After 4 seconds, you’ll automatically be redirected to our home page. Sorry for this inconvenience. " "Content-Type" "text/html" }
if { [HTTP::status] == 400 } {
HTTP::respond 200 content " Unfortunately, your request for ${hostvar}${urivar} casued a error. After 4 seconds, you’ll automatically be redirected to our home page. Sorry for this inconvenience. " "Content-Type" "text/html" }
}