Forum Discussion

funkdaddy_31014's avatar
funkdaddy_31014
Icon for Nimbostratus rankNimbostratus
Mar 03, 2011

reference a VIP's default pool within iRule?

I have an iRule that I want to use with different VIPs where each VIP may have a different default pool specified in the VIP configuration.

 

 

I'm wondering if I can generically reference the default pool within the iRule, so it will send traffic to different pools depending on which VIP calling the iRule.

 

 

I.E.:

 

 

when HTTP_REQUEST {

 

switch -glob [HTTP::path] {

 

"/abc/proxy.jsp" {

 

pool default <--the default pool for the VIP to which this iRule is applied

 

}

 

"/xyz*" {

 

pool xyz_pool

 

}

 

...

 

default {

 

pool def_pool

 

}

 

}

 

}

 

 

Thanks,

 

-Funkdaddy

 

2 Replies

  • You can use [LB::server pool] in CLIENT_ACCEPTED to get the name of the virtual server's default pool before it's change in the iRule:

    
    when CLIENT_ACCEPTED {
    
        Save the name of the virtual server's default pool before it's change in this iRule
       set default_pool [LB::server pool]
    }
    when HTTP_REQUEST {
        switch -glob [HTTP::path] {
            "/abc/proxy.jsp" {
                pool $default_pool
            }
            "/xyz*" {
                pool  xyz_pool
            }
            ...
            default {
              pool $default_pool
            }
        }
    }
    

    Aaron