Forum Discussion

2 Replies

  • 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).

     

  • 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]
        }
    }