For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Pierrejn's avatar
Pierrejn
Icon for Nimbostratus rankNimbostratus
Feb 06, 2017

iRule Help Please

I'm trying to combine L7 Load Balancing with sending a maintenance page if the pool/pools are down. Please see below.

 

Code when HTTP_REQUEST {
if { [class match [string tolower [HTTP::host]] equals _http_pools] } {
    pool [class match -value [string tolower [HTTP::host]] equals _http_pools]
}
}

and trying to combine the following

 

Code when HTTP_REQUEST {
set VSPool [LB::server pool]
if { [active_members $VSPool] < 1 } {
log local0. "Client [IP::client_addr] requested [HTTP::uri] no active nodes available..."
HTTP::respond 200 content "



We'll be back!



IMPORTANT MESSAGE 

Please be advised that we are performing a scheduled maintenance on the site you are trying to access.  All site access will be unavailable during this maintenance.  Service is expected to resume February 4 at 5 a.m. CT 

"
     }
    }

1 Reply

  • Hi Pierrejn,

    the iRule below is a combination of your two dedicated iRules...

    when HTTP_REQUEST { 
        set VSPool [class match -value [string tolower [HTTP::host]] equals _http_pools]
        if { $VSPool ne "" } then {
            if { [active_members $VSPool] > 0 } then {
                pool $VSPool
            } else {
                log local0. "Client [IP::client_addr] requested [HTTP::uri] no active nodes available..."
                HTTP::respond 200 content "
    
        
            
            We'll be back!
            
        
        
            
                IMPORTANT MESSAGE 
                
                Please be advised that we are performing a scheduled maintenance on the site you are trying to access.  All site access will be unavailable during this maintenance.  Service is expected to resume February 4 at 5 a.m. CT 
            
        
    "
    
            }
        } else {
             Unknown HOST-Name requested...
        }
    }
    

    Note: Updated the post to correct a formating glitch...

    Cheers, Kai