Forum Discussion
bilal_01_143886
Nimbostratus
Sep 18, 2014Redirect traffic to other pool member if other sends http error code 502, 503 and 504
Hi,
I need to redirect traffic to other pool member if second member sends an http error code 502,503 and 504. Please suggest the most appropriate solution.
2 Replies
- Thomas_Gobet
Nimbostratus
Hi,
To do that you just have to use a HTTP monitor.
If your monitor sees 50x code as response, this pool member will be marked as unavailable (it won't receive any traffic). - spud_141786
Nimbostratus
These error may be transient so marking a server down may not be ideal. The following iRule was suggested for a similar request here https://devcentral.f5.com/questions/irule-to-catch-4xx-and-5xx-http-error-codes:
when CLIENT_ACCEPTED { set retry 0 } when HTTP_REQUEST { set http_request [HTTP::request] } when HTTP_RESPONSE { if { ([HTTP::status] starts_with "4") || ([HTTP::status] starts_with "5")} { incr retry if { $retry <= [active_members [LB::server pool]] } { HTTP::retry $http_request } else { set retry 0 } } else { set retry 0 } } when LB_SELECTED { log local0.info "Run $retry"; if { ($retry > 0) && ($retry <= [active_members [LB::server pool]])} { LB::reselect pool [LB::server pool] } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
