Forum Discussion

leon_107471's avatar
leon_107471
Icon for Nimbostratus rankNimbostratus
Jan 12, 2008

HTTP_RESPONSE codes

Hi

 

Can someone help me translate the below irule to the correct irule syntax?

 

Thanks in advance

 

 

when HTTP_RESPONSE {

 

if { [HTTP::status] starts_with "1, 3, 4 ,5" } {

 

LB::down

 

}

 

}

 

 

when HTTP_RESPONSE {

 

if { [HTTP::status] starts_with "2" } {

 

LB::up

 

}

 

}

1 Reply

  • That should work to mark a pool member as down if the response code isn't a 200. However, there are many instances where a web server could legitimately reply with a non-200 response. Take a look at the HTTP 1.1 RFC's section on response codes for examples:

     

     

    http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

     

     

    You might be better off looking only for 50x errors, as these indicate a server-side error. You might also want to select a new node

     

     

    
    when HTTP_RESPONSE {
       if {[HTTP::status] starts_with {5}}{
          LB::down
       }
    }

     

     

    You could also look into reselecting a new pool member if the request does generate a 5xx response, using LB::reselect.

     

     

    Aaron