Forum Discussion
Nov 06, 2010
404 status issue
Hello All, I'm curious as this is weird behavior I've encountered with this set of code: when HTTP_RESPONSE { if { ([HTTP::status] equals "404") } { if a 404 is ret...
Chris_Miller
Nov 07, 2010Altostratus
A page is merely a collection of objects for which HTTP GET requests must be made. If for instance a page had 12 images, a 404 for any of them could trigger the rule. Also, HTTP::host shouldn't be used in HTTP_RESPONSE since there's no host header. You'll want to set a variable from HTTP_REQUEST and check the variable from HTTP_RESPONSE.
Something like this would work:
when HTTP_REQUEST {
set hostvar [HTTP::host] } }
when HTTP_RESPONSE {
if { [HTTP::status] eq "404" } {
if a 404 is returned, send a 301 redirect for our custom 404 page
HTTP::respond 301 Location "http://$hostvar/portal/site/erp/404/" } }
Let me know if you have any issues with that.
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