Forum Discussion

J_Saunders_4728's avatar
J_Saunders_4728
Icon for Nimbostratus rankNimbostratus
Jun 19, 2012

Redirect to Maintenance page iRule help

All,

 

 

I need to apply an iRule to 3 HTTP and 3 HTTPS VIP's. I want the iRule to redirect users to a maintenance page if none of the pool members are available.

 

 

I found this:

 

 

when CLIENT_ACCEPTED {

 

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

 

HTTP::redirect "http://maintenance_site.com" }

 

}

 

 

 

My questions are:

 

 

- will the above work for both HTTP and HTTPS VIP's?

 

- is 'server pool' an actual F5 generic command? Or should I be specifying the pool name

 

- if 'server pool' is an F5 command, then I assume I can use this 1 iRule for all of my VIPs

 

 

Thanks

 

3 Replies

  • Hi J Saunders,

    - Will the above work for both HTTP and HTTPS VIP's?

    Yes.

    - Is 'server pool' an actual F5 generic command? Or should I be specifying the pool name

    Yes. In this situation you are specifically using LB::server pool, which returns the pool of the currently selected member.

    - If 'server pool' is an F5 command, then I assume I can use this 1 iRule for all of my VIPs

    Yes. It would dynamically detect the information.

    If you would like to verify you can add a logging statement and then look in your LTM Log:

    
    when HTTP_REQUEST {
    if { [active_members [LB::server pool]] == 0 } {
    log local0. "Server Pool:  [LB::server pool]"
    HTTP::redirect "http://www.google.com"
    }
    }
    

    Hope this helps.
  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus
    Don't forget to set the HTTP response code on the maintenance page to 503. You don't want to run the risk of having Google index your maintenance page (makes the Marketing folks really cranky)...