Forum Discussion
Jeff_42220
Nimbostratus
Aug 14, 2009404 redirect irule adding requested URL
We use a separate sorry server on our network, and I am trying to figure out how to write an irule that will redirect users to that sorry server when they get a 404 error. I would like the originally requested URL to be passed along as part of that redirect, possibly in an HTTP header so that it can then be read off the sorry server and displayed on the page. How should I do this?
We have the basic 404 irule redirect already in place, but I don't know if I should add the requested Host/URI information into the redirect somehow or if I should accomplish this by some other means. Again, our goal is to have the 404 redirect go to our sorry server, but have something in that redirect that will include the original Host/URI passed over to our sorry server for display on that web page somehow.
when HTTP_RESPONSE {
if { [HTTP::status] contains "404"} {
HTTP::redirect "http://sorryserver"
}
}
Thanks for your assistance!
-Jeff
- hoolio
Cirrostratus
Hi Jeff,when HTTP_REQUEST { Save the host/URI so it will be available in the HTTP_RESPONSE event set url [HTTP::host][HTTP::uri] } when HTTP_RESPONSE { Check for a 404 response if { [HTTP::status] == 404} { Redirect the client to the sorry page with the original host/URI set as a URI encoded parameter HTTP::redirect "http://sorryserver?original_url=[URI::encode $url]" } }
- Jeff_42220
Nimbostratus
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