Forum Discussion

Dave_Horsey_225's avatar
Dave_Horsey_225
Icon for Nimbostratus rankNimbostratus
Jan 25, 2006

fail to other pool member based on http status code

We have two servers in a pool behind our LTM. The web servers serve traffic for around 4000 domains on one IP. We would like to have the LTM redirect traffic to the other pool member if either server reponds to a request with anything but a 200 OK response. Is this possible with iRules or a feature on the 9.2.2 release?

 

 

We are currently using BIG-IP 9.0.5 Build 59.7 on a BIG-IP 1500 LTM.

 

 

  • If we could make the http status code only trigger if the reponse is 400 or greater, that would be better since the sites will only repond with 200 OK or 301-302 redirects.
  • Just check the HTTP::status value on the response and issue a HTTP::redirect if it matches your criteria.

    This iRule should do the trick.

    when HTTP_RESPONSE {
      if { [HTTP::status] >= 400 } {
        HTTP::redirect "http://www.someotherdomain.com/"
     }
    }

    I would just watch out for 401 (authentication required) status codes. You would likely not want to redirect the user in this case.

    Another option exists if all you want to do is present an error message. You can use the HTTP::respond command to send custom HTML back to the user directly from within the iRule. This would eliminate the need for a separate backend server just to service errors. If you have application logic you need to run on the redirect, then this won't really help you.

    -Joe
  • I guess, I should have read your question closer. You were asking how to forward the request to a second pool based on the response.

     

     

    Check out this forum thread that discusses LB::reselect and HTTP::retry

     

     

    http://devcentral.f5.com/Default.aspx?tabid=28&view=topic&forumid=5&postid=5201

     

    Click here

     

     

    -Joe