iRule to rebind session(s) from failed member server to another server in a pool based on http error code(s)

Has anyone created an iRule for this?

We have 2 servers in a pool using round robin. If a service on that server fails or returns an error code, we want the session(s) on that server to rebind to the available member server.

Any info is appreciated.

Take a look at the first and second examples on the HTTP::retry wiki page:

https://devcentral.f5.com/wiki/iRules.HTTP__retry.ashx

These iRules capture an error response and replay the original request to the next pool member.

Thanks Kevin! I will check it out.

Kevin, I edited the HTTP_RESPONSE below and did not get an error when I applied it. Will the rule work if the status starts with either “5” or “4”? Or will I have to create two separate iRule for each status? Please advise. Thanks!

when HTTP_RESPONSE { 28 Check for server errors 29 if { [HTTP::status] starts_with “5” or “4” } {

Your conditional would look something like this:

if { ( [HTTP::status] starts_with "4" ) or ( [HTTP::status] starts_with "5" ) }

Thanks again Kevin!