Moinul_Rony
Aug 27, 2013Altostratus
Redirect to a custom error page when server response is matched with any specific code
Hi I need to respond and redirect on custom response from the server ( tomcat/apache )
I have this iRule , just need to verify if the following iRule should work if we wanted to create a respond page and then redirect the traffic to the homepage ?
when HTTP_REQUEST {
set hostvar [HTTP::host]
set urivar [HTTP::uri]
set delay 4
}
when HTTP_RESPONSE {
if { [HTTP::status] eq “404 } {
HTTP::respond 200 content \ “
Unfortunately, your request for $hostvar$urivar casued a 404 error. After 4 seconds, you’ll automatically be redirected to our home page. If you feel you’ve tried a valid link, please contact webmaster@sample.com. Sorry for this inconvenience.
” “Content-Type” “text/html”
}
}
Here using HTTP:respond we are holding the user for a delay and then sending the redirect to www.mysite.com.
If you can check the code and verify this works that would be great...
Thanks.