Forum Discussion

Matthew_Shaw_64's avatar
Matthew_Shaw_64
Icon for Nimbostratus rankNimbostratus
Aug 29, 2007

LB::server pool behaviour clarification?

I have a simple iRule that tries to send requests for certain urls to a custom pool rather than the default pool associated with the virtual server:

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] starts_with "/myapp" } {

 

pool "myapp_pool"

 

}

 

}

 

 

I have noticed that for a browser making requests to urls that both match and don't match /myapp, some of the non /myapp urls will go to the myapp_pool rather than the default pool.

 

 

This construct (which I've seen in some DevCentral posts) seems to work reliably:

 

 

when CLIENT_ACCEPTED {

 

set default_pool [LB::server pool]

 

}

 

 

when HTTP_REQUEST {

 

if { [HTTP::uri] starts_with "/myapp" } {

 

pool "myapp_pool"

 

} else {

 

pool $default_pool

 

}

 

}

 

 

Is this the 'correct' way to ensure that the request goes to the correct pool?

 

 

Thanks.

 

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Setting a default pool like you are above in the CLIENT_ACCEPTED section probably won't achieve what you want it to, since the BIG-IP hasn't made a new load balancing decision yet, and you'll basically be setting the default_pool variable to whatever pool was selected on the last step through the rule.

     

     

    Is there a default pool defined for this Virtual? If not, I'd try that first.

     

     

    HTH,

     

    Colin