Forum Discussion
hooleylist
Cirrostratus
Jul 04, 2010The HTTP class selected with HTTP::class in an iRule does need to be associated with the VS or you'll get a runtime error when the rule is executed. You can use an iRule to override the HTTP class selection done by LTM, but you'll need to do this in the HTTP_CLASS_SELECTED event (and possibly HTTP_CLASS_FAILED if there is a chance a request might not match any HTTP class).
Also, if you're trying to check the default pool on the VS, you'd want to save the name of it in CLIENT_ACCEPTED as 'LB::server pool' will return the name of the currently selected pool. This wouldn't be the default pool if a prior request on the same TCP connection went to the other class.
However, if you want to use the same HTTP class regardless of which pool is up, you could not bother selecting the class in the iRule and just select the pool:
when CLIENT_ACCEPTED {
Save default pool name
set default_pool [LB::server pool]
}
when HTTP_CLASS_SELECTED {
if { [active_members $default_pool] > 0 } {
pool $default_pool
} else {
pool alternate_pool
}
}
Aaron