Forum Discussion
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"
}
}1 Reply
- nitass
Employee
There is first variant proposed to customer, but they need send to client side exactly 404 code.
you can send 404 with meta refresh using HTTP::respond command. the command should look like this except code is 404 instead of 200. anyway, i think it may not be good for SEOs.
Redirect to a custom error page when server response is matched with any specific code
https://devcentral.f5.com/questions/redirect-to-a-custom-error-page-when-server-response-is-matched-with-any-specific-code404 Error Pages and Redirects for SEOs
http://www.mcanerin.com/en/articles/301-redirect-404-error.aspjust my 2 cents.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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