Deepak_Nair
Mar 10, 2021Cirrus
HTTP 404 ERROR HANDLING through IRULE
Hello Experts ,
I am trying to build an irule which will send a HTTP 404 error CODE if the user intentionally or mistakenly typed a wrong URL .
Below is the IRULE that i have written :
when HTTP_REQUEST {
if {([string tolower [HTTP::host]] equals "xyz.APAC.com") && [HTTP::uri] starts_with "/ARCHIAC" } {
HTTP::uri [string map [list "/archiac/" "/arcgis/" ] [HTTP::uri]]
pool PL_BNE_ENT_6443
return
}
if {([string tolower [HTTP::host]] equals "xyz.APAC.com") && [HTTP::uri] starts_with "/archiacportal" } {
pool PL_BNE_ENT_arcgisportal_443
return
}
if {[HTTP::uri] matches_regex ".*" } {
HTTP::respond 404 content {Page Not Found Page Not Found}
}
}
This irule work fine for most of the cases . BUT if any user start the URI with /ARCHIACjkaejksfsdjkhdfsj , this request will be send to server .
Same is TRUE with /archiacportalsdfjkbasdjkfbsd .
If there any way to discard the junk characters with HTTP 404 error when someone start the URI with above STRINGS ???