Forum Discussion
Moinul_Rony
Altostratus
Aug 27, 2013Redirect 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 ...
hoolio
Cirrostratus
Aug 27, 2013Can you try this?
Also, you should consider HTML encoding the host and URI values in the iRule to protect site users from XSS.
You can do this using string map:
https://devcentral.f5.com/wiki/iRules.HTML_encoding_proc.ashxwhen 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 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"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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