Forum Discussion

Puneet_73909's avatar
Puneet_73909
Icon for Nimbostratus rankNimbostratus
Dec 16, 2009

LB_Failed redirection

We need the LB to look at its pool of webServers and if the primary pool members are down, then redirect the incoming requests to another webServer and obviously display what that webServer is returning.

 

 

And STATUS CODE in the Response Header at this time should display a 503 status for any requests coming in.

 

 

when LB_FAILED {

 

if { [active_members [LB::server pool]] < 1 } {

 

snatpool PROD_WebSrvrs

 

pool pool_7185

 

}

 

}

 

 

Above rule is not working.....Pls help

 

 

 

3 Replies

  • Do you want to select the second pool at the time of the initial request or only when load balancing fails? If the former, can you change the event from LB_FAILED to CLLIENT_ACCEPTED or HTTP_REQUEST?

    If the latter, can you try using LB::reselect:

     
     when LB_FAILED { 
        if { [active_members [LB::server pool]] < 1 } { 
           snatpool PROD_WebSrvrs 
           LB::reselect pool pool_7185 
        } 
     }  
     

    Here are a few related examples:

    Help with avoiding Reselect bug in LB_Failed

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=34031

    downing a member from LB_FAILED

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&tpage=1&view=topic&postid=62849

    Aaron
  • Thanx Hoolio...

     

    I have used Client Accepted and it is somehow working.

     

     

    But I also need 503 header response.

     

     

  • So you want to replace whatever status code the new pool member sets with a 503?

     

     

    HTTP::status (Click here) can only be used to get (not set) the status of the response. So to "change" the status you could need to send your own response using HTTP::respond (Click here) . It's fairly simple if you can send your own response content. Or if you need to leave the response data from the server intact, you'd need to collect the payload for the specific responses and then use HTTP::respond to send a 503 response with the original payload. You can check the HTTP::collect wiki page (Click here) for examples.

     

     

    Aaron