Forum Discussion
Dayton_Gray_103
Nimbostratus
Oct 29, 2008Custom 404 passthrough question.
I have the following iRule in place:
when HTTP_REQUEST {
if { [HTTP::uri] contains "pagenotfound.html" } {
event disable all
}
}
when HTTP_RESPONSE {
if { [HTTP::status] == "404" or [HTTP::status] == "500" }{
HTTP::redirect "http://www.yournamehere.com/error/pagenotfound.html"
}
}
I am hoping it is possible to modify this to keep the original URL but send back the pagenotfound.html content, similar to a passthrough directive on apache. Is this at all possible?
Thanks!
- hoolio
Cirrostratus
Hi Byzandula, - Dayton_Gray_103
Nimbostratus
Thanks for the reply Aaron,when HTTP_REQUEST { if { [HTTP::uri] contains "404.jsp" } { event disable all } } when HTTP_RESPONSE { if { [HTTP::status] == "404" or [HTTP::status] == "500" }{ HTTP::uri "/404.jsp" This doesn't work in HTTP_RESPONSE LB::reselect pool error_pool This doesn't work in HTTP_RESPONSE } }
- hoolio
Cirrostratus
If you want to reselect a member of a new pool, you'd need to use HTTP::retry from HTTP_RESPONSE. You can then specify a new pool in HTTP_REQUEST if the failure condition is true for that request. I've done a quick search for this specific scenario, but I don't see any identical posts. There are quite a few similar posts though in this forum. If you searching and get stuck, reply with what you've tested. - Dayton_Gray_103
Nimbostratus
I think I've found a solution, but I wanted to see if there are other ideas on how to do it, or if this seems at all silly:when CLIENT_ACCEPTED { set retries 0 } when HTTP_REQUEST { set request [HTTP::request] } when LB_SELECTED { if { $retries >= 1 } { LB::reselect pool server_404 } } when HTTP_RESPONSE { if { [HTTP::status] == "404" or [HTTP::status] == "500" } { incr retries HTTP::retry $request } }
RewriteEngine on RewriteCond %{REQUEST_URI} !^/error/404.html RewriteRule ^/.*$ /error/404.html [PT,L]
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