Forum Discussion
Narendra_26827
Jul 08, 2011Nimbostratus
iRule to redirect request to another node if HTTP response is 404
Hi,
I want to create an iRule in which if i get an HTTP 404 response from a node in the pool i will be able to break the IP persistence and pass it to another node in the pool and for next request the ip persistence can be enabled again.
Thanks.
- hooleylistCirrostratusHi Narenda,
when CLIENT_ACCEPTED { set retries 0 } when HTTP_REQUEST { Don't retry requests with a payload as we don't want to have to collect every payload to retry 404 responses switch [HTTP::method] { "GET" - "HEAD" { set request_headers [HTTP::request] } default { set request_headers "" } } } when HTTP_RESPONSE { if {$request_headers ne "" && $retries < [active_members [LB::server pool]]}{ switch [HTTP::status] { 404 { incr retries HTTP::retry $request_headers } } } }
- Narendra_26827NimbostratusHi Aaron Thanks for the giving the approach.
- hooleylistCirrostratusI'd be wary of using a 404 as a sign of an unhealthy pool member. A client could easily DOS a web app by making requests for known non-existent pages in the app. Search engines could easily do this inadvertently.
- Colin_Walker_12Historic F5 AccountI'd agree wtih Aaron here. A 404 is not a sign of a server that's unhealthy, it's a sign of a user making requests for pages that don't exist, more often than not. ;)
- Narendra_26827NimbostratusThanks Michael/Aaron/Colin for your kind suggestions.
- Michael_YatesNimbostratusI agree with Hoolio and Colin.
- Narendra_26827NimbostratusHi Michael actually we are on testing phase so we are testing with http errors right now (Our application is not yet ready). Going on production we will be using some header value inserted into http response so that we will be able to decide to which node or pool it should go. It will not be an http error. But your point is duly taken into consideration here.
- Colin_Walker_12Historic F5 AccountOh that makes more sense. A 404 is an easy way to test. ;)
- Narendra_26827NimbostratusYeah that's why! :))
- Colin_Walker_12Historic F5 AccountLooks pretty good. Basically you want to retry once and then find a new server? Is that working for you?
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