Forum Discussion

Ed_Ferrageau_67's avatar
Ed_Ferrageau_67
Icon for Nimbostratus rankNimbostratus
Feb 01, 2008

Redirect when all poolmembers are down

Hi,

 

I'm trying to figure out how I can redirect a request to an "external" errorpage, when all poolmembers are down. I have no experience with iRules, so any help is more than welcome.

 

Thanks.

 

Ed

5 Replies

  • Hello,

     

     

    You can do this without a rule using the fallback host on the HTTP profile associated with the virtual server. Check the LTM config guide's section on the HTTP profile for details.

     

     

    Else, if you want to use an iRule, you can do so following the example in SOL7065 (Click here).

     

     

    Aaron
  • Here's one that I use:

    
    when HTTP_REQUEST {
     set mypool [active_members somepool]
     switch $mypool {
      "0" {
       HTTP::redirect "http://www.mydomain.com/maintenance.html" 
      }
      default {
       pool mybackup_pool 
      }
     }
    }
  • Aaron, wschultz,

     

    Thanks a lot. This was indeed what I was looking for.

     

    Cheers.

     

    Ed
  • This also works to if you have no suitable external site to redirect to. I simply have the BIGIP do a content subsitution with the HTML contained in the pool_error string.

     

     

    when HTTP_REQUEST {

     

    }when RULE_INIT {

     

    set pool_error {

     

     

     

     

     

    No Servers Available are in the Requested Virtual Server's Pool

     

     

     

     

     

     

     

    INSERT YOUR HTML HERE!!!

     

     

     

     

     

    }

     

    }

     

    when HTTP_REQUEST {

     

    if {[active_members your_pool_here ] < 1 } {

     

    HTTP::respond 200 content [subst $::pool_error]

     

    }

     

    }

     

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    That's a good point. The HTTP::respond command is extremely powerful in that it allows you to send back custom HTML content directly from the BIG-IP. It also saves you from having to send the client a redirect, which some clients will complain about, depending on their security settings.

     

     

    Colin