Forum Discussion
Moinul_Rony
Altostratus
Dec 09, 2013how to ignore internal 404 response and only activate a irule on a full page 404 response ( such as css, image etc. )
Hi,
Just for a background I have a irule to catch 4xx and 5xx response and do a generic html response and redirect to maintenance/homepage.
All was working good until some pages had intern...
IheartF5_45022
Nacreous
Dec 09, 2013If you page 'breaks' when you get a redirect to a maintenance page for an includes-type object, then I suspect that it will 'break' when you get a 404. However to answer your actual question this should work;-
when RULE_INIT {
List of well known 'page' extensions
set static::l_ext [list "" "do" "htm" "html" "jsp" "asp" "aspx" "wml" "xhtml" "json" "cfm"]
}
when HTTP_REQUEST {
Save variable for possible later use in HTTP_RESPONSE
set request [HTTP::uri]
}
when HTTP_RESPONSE {
if {[HTTP::status] == 404 && [lsearch $static::l_ext [string tolower [getfield [URI::basename $request] "." 2]]] != -1 } {
HTTP::respond 302 noserver Location "http://mycomapny.com/sorry_404.htm"
return
}
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