Forum Discussion

Andy_Sutton's avatar
Andy_Sutton
Icon for Nimbostratus rankNimbostratus
May 18, 2007

irule when pool members are down

I'm trying to setup a basic irule to redirect to an alternate website when my pool members are down for a give virtual. I've found some other posts that yield the code to do this such as:

 

 

when LB_FAILED {

 

switch [LB::server pool] {

 

default {

 

HTTP::redirect http://maint.mydomain.com

 

}

 

}

 

}

 

 

or

 

 

when LB_FAILED {

 

log local0.err "ERR: Load Balancing failed for [virtual name] Pool: [LB::server] Client: [IP::remote_addr]"

 

HTTP::redirect "http://maint.mydomain.com"

 

}

 

 

The problem I find is that on my 9.3 LTM when all the pool members are down the virtual is marked down and no longer accepts connections hence not running the irule. If any pool members are up then the irule doesn't see a failure of LB_FAILED and so doesn't redirect.

 

 

Seems like everyone would want this type of redirect to avoid the user getting a 404 response. The ONLY thing I've been able to do to get a page like this is the fallback host on the http profile but that doesn't allow for me to feed any parameters like referring URL to the page like I'd want. Any suggestions?

1 Reply

  • Nevermind I found the trick

     

     

    Here is my iRule

     

     

    when LB_FAILED {

     

    if { [active_members [LB::server pool]] != 0 } {

     

    } else {

     

    HTTP::fallback "HTTP://my.sitedown.com/index.asp?site=[HTTP::host]"

     

    }

     

    }

     

     

     

    On the backside I have an ASP page that interprets the HTTP::host and displays it along with a pretty graphic and a nice message.