Forum Discussion

Tadaoki_237078's avatar
Tadaoki_237078
Icon for Nimbostratus rankNimbostratus
Oct 03, 2017

iRule(event) evaluation

Hi all,

 

I have some questions about iRule evaluations:

 

If an event is triggered but the traffic doesn't match any of the conditions, what will happen?

 

(e.g. what will the following iRule do if pool_fubar has more than 1 active member? And does it mean anything if the Virtual Server has a default pool configured or not?)

 

ltm rule /Common/rule_Fubar {

 

when HTTP_REQUEST {

 

if { [active_members pool_fubar] < 1 } {

 

HTTP::respond 200 content [ifile get sorry_file] "Content-Type" "text/html"

 

}

 

}

 

}

 

Thank you in advance,

 

Kai

 

2 Replies

  • Hi Kai,

     

    If the pool_fubar has more than 1 active member it will not match this condition and depending on the VS configuration but if a default pool_member is assigned request will be load balanced to that particular pool.

     

    If the VS has no pool member assigned and has no other irule that redirect traffic to a pool or a VS, requests are dropped or rejected...

     

    Hope it helps

     

    Regards

     

  • Hi,

     

    JTI provides the right response. This answer is to help you to optimize the code.

     

    when working with virtual server, there is more and more virtual server distributing request to different pools based on hostname or URI. If you apply your code to a such virtual server, every content will display the maintenance page if pool_fubar is unavailable.

     

    this code is more generic and can manage per request maintenance pool detection.

     

    when HTTP_REQUEST {
        if { [active_members [LB::server pool]] < 1 } { 
            HTTP::respond 200 content [ifile get sorry_file] "Content-Type" "text/html"
        }
    }