Daeron_165943
Aug 07, 2014Nimbostratus
HTTP: respond 404 and redirect to url
Greetings,
I need a solution to respond to client with code 404, and redirect to page with custom 404 error, when client requests specific uri, and his ip is not in rfc1918 range. Right now i dont have access to F5 VIPs through network, so i cant start experimenting. I suspect that HTTP::respond 404 Location "http://example.com/404.html" will not work, or i wrong? Where can i learn about operators that can be used with particular response codes? I spend a couple of hours on devcentral, but don't find similar problem. There is first variant proposed to customer, but they need send to client side exactly 404 code.
if { ([HTTP::path] starts_with "/pattern") } {
if { (! ( [IP::addr [IP::client_addr] equals 10.0.0.0/8])) and
(! ( [IP::addr [IP::client_addr] equals 172.16.0.0/12])) and
(! ( [IP::addr [IP::client_addr] equals 192.168.0.0/16])) } {
HTTP::respond 301 Location "http://example.com/404.html"
}
}