Moinul_Rony
Sep 25, 2013Altostratus
custom error page based on /URI
Hi I have a iRule on our application server that is catching all 4xx and 5xx error responses and responds with a custom response using the below iRule. We have some application that has inbuilt error page set up and we don't want to put the iRule on those apps. So what I am looking for is to implement the existing iRule based on /URI
when HTTP_REQUEST {
set http_request [HTTP::request]
set appvar [HTTP::cookie JSESSIONID]
set http_request_time [clock clicks -milliseconds]
set LogString "Client [IP::client_addr]:[TCP::client_port] -> [HTTP::host][HTTP::uri]"
set delay 4
}
when HTTP_RESPONSE {
if { ([HTTP::status] starts_with "4") || ([HTTP::status] starts_with "5")} {
HTTP::respond 200 content " MySite\
Oops! Something went wrong. Please try again.\
Sorry for this inconvenience. " "Content-Type" "text/html"
log local0. "$LogString (response) - pool info: [LB::server] - status: [HTTP::status] (request/response delta: [expr {[clock clicks -milliseconds] - $http_request_time}] ms)"
log local0. "Session ID was $appvar"
}
}
Thanks - Rony