Forum Discussion

Sake_Blok's avatar
Sake_Blok
Icon for Nimbostratus rankNimbostratus
Mar 14, 2005

iRule not using default pool

Hi,

I build an iRule that chooses a node, based on a server-id cookie. In the rule I check whether the cookie is present, if not, the rule defaults to the configured pool. If the cookie is present, it uses findclass to select a node. It all works fine, up until there is a request with the cookie, but with an unknown value. I would expect the iRule to fall back to the default pool, but instead it terminates the session with a TCP-RST. To make it use the default pool, I had to add the pool command, but that makes this rule less general.

Can anyone tell me why the iRule terminates the session instead of use the configured pool when the cookie was found and it's value was not found in the class?

Cheers, Sake

Here is the relevant config:

   
 class nodes_testlab {  
    "web-s01 192.168.103.1:80"  
    "web-s02 192.168.103.2:80"  
 }  
    
 pool testlab {  
    monitor all http  
    member 192.168.103.1:http  
    member 192.168.103.2:http  
 }  
     
 rule cookie_lbsid {  
    when HTTP_REQUEST {   
       if { [HTTP::cookie exists "lbsid"] } {   
          set tmp [findclass [HTTP::cookie "lbsid"] $::nodes_testlab " "]  
          if { $tmp ne "" } {  
             log local0. $tmp   
             node $tmp  
          } else {  
             log local0. "Not a valid cookie-value!"  
             pool testlab    <--- I'd like to remove this statement!  
          }  
       }  
    }  
 }  
     
 virtual test-vip {  
    destination 192.168.100.200:http  
    ip protocol tcp  
    profile http tcp  
    pool testlab  
    rule cookie_lbsid  
 }  
 

2 Replies

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Yes, we know about this issue. The problem has to do with successive requests in the same connection. When the first request is complete, the serverside of the connection is detached. After the detach, we don't re-initialize the pool pick to the default one assigned on the virtual.

    You can try the following modifications to your rule to save the default pool and reuse it, thus generalizing your rule to be used with many virtuals.

     
     rule cookie_lbsid { 
        when CLIENT_ACCEPTED { 
           set defpool [LB::server pool] 
        } 
        when HTTP_REQUEST { 
           if { [HTTP::cookie exists "lbsid"] } { 
              set tmp [findclass [HTTP::cookie "lbsid"] $::nodes_testlab " "] 
              if { $tmp ne "" } { 
                 log local0. $tmp 
                 node $tmp 
              } else { 
                 log local0. "Not a valid cookie-value!" 
                 pool $defpool 
              } 
           } 
        } 
     } 
     
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    When you say "extract a pool member", I'm not sure what you really want to do. Are you wanting to get a list of the pool members in a pool?