Forum Discussion

James_Hamoline_'s avatar
James_Hamoline_
Icon for Nimbostratus rankNimbostratus
Sep 22, 2005

ReSelect on 500 Response

Hey guys,

 

One of our architects talked to you at PDC. I have been trying to find some documentation on the LoadBalance Reselect command that Colin Walker talked about but I have been unsuccessful. Can you tell me where I can find some documentation on that?

 

 

What we are trying to accomplish is on a response http status code of say 500 we want to reselect a different server from the pool. We were told that this could not be done by F5 support but if there is a way to happen. Can I see some documentation on it.

 

 

Here is a link to the interview from PDC that makes some mention of what we are trying to accomplish, along with Colin Walkers comments.

 

 

http://devcentral.f5.com/Media/Videos/20050915-PDCVidThread1.wmv

 

 

Thanks for the help guys.
  • If you have cookie persistence enabled on your Virtual Server Profile, is there a way to use this irule and have it redirect the user to the other node in the pool?

     

     

    Otherwise, if you have persistence enabled on your Virtual Server, the irule will just throw the request into a constant loop.
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I'm not sure that would help, since the BigIP actually load-balanced to the server and the server gave the 500 response. The LB_FAILED event wouldn't have triggered in this case.

    What you would want to do is overwrite the persistence cookie in the redirect. Unfortunately, you need to specify the Set-Cookie for the persistence cookie at the same time you do the redirect and the redirect command doesn't support this. However, you can use the HTTP::respond command. Something like this is what you would want to do:
    
    HTTP::respond 302 Location "http://www.youviphere.com" Set-Cookie2 "BIGipServermy_pool=; discard"

    Replace the BIGipServermy_pool with whatever your persistence cookie name is.

  • So then, my irule would look like this...

     

     

    when HTTP_RESPONSE {

     

    if {[HTTP::status] >= 500} {

     

    HTTP::redirect "http://www.sitename.com"

     

    }

     

    {HTTP::respond 302 Location "http://www.sitename.com" Set-Cookie2 "sitename_pool=; discard"}

     

    }
  • Sorry, I mean the rule would like loike this...

     

     

    when HTTP_RESPONSE {

     

    if {[HTTP::status] >= 500} {

     

    HTTP::respond 302 Location "http://www.sitename.com" Set-Cookie2 "poolname=; discard"}

     

    }