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 r...
Narendra_26827
Jul 11, 2011Nimbostratus
Thanks Michael/Aaron/Colin for your kind suggestions.
I have created a iRule like below to redirect the requests to different pool if a node sends http 404. Persistence is enabled at request, if http 404 comes it can break the persistence (i think it will work without that also) and redirect to another pool.
when CLIENT_ACCEPTED {
set retries 0
}
when HTTP_REQUEST {
persist source_addr
set request_headers [HTTP::request]
}
when LB_SELECTED {
if { $retries > 0 } {
persist none
LB::reselect pool Sample_Pool_1
}
}
when HTTP_RESPONSE {
if { $request_headers ne "" && $retries < [active_members [LB::server pool]] } {
switch [HTTP::status] {
404 {
incr retries
HTTP::retry $request_headers
}
}
}
}
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