LB::server pool returns empty string
I need to switch between two different pools, based on the url. I found the following pattern in several answers:
when CLIENT_ACCEPTED {
set default_pool [LB::server pool]
}
when HTTP_REQUEST {
if { ... } {
pool $default_pool
} else {
pool other_pool
}
}
However, LB::server pool always returns an empty string. I have configured a default pool and the behavior appears if a oneconnect profile is set as well as when no oneconnect profile is set.
I am on version 11.5.3.
Edit In response to Kai Wilke
: 1 - LB::server_pool =
: 1 - $default_pool =
: 2 - LB::server_pool = /Common/DefaultPool
: 2 - $default_pool = /Common/DefaultPool
When I attach an OneConnect profile, the pool is not reset to the default one. Resetting it to the default would solve the problem though. Independently of a OneConnect profile being present I have to reset the pool explicitly to the default one.
Edit based on the assumptions by Brad Parker
I changed the code to this pattern:
when CLIENT_ACCEPTED {
set default_pool ""
}
when LB_SELECTED {
if { $default_pool == "" } {
set default_pool [LB::server pool]
log local0.debug "1 - LB::server_pool = [LB::server pool]"
set default_pool [LB::server pool]
log local0.debug "1- \$default_pool = $default_pool"
pool DefaultPool
log local0.debug "2 - LB::server_pool = [LB::server pool]"
set default_pool [LB::server pool]
log local0.debug "2 - \$default_pool = $default_pool"
}
}
when HTTP_REQUEST {
if { $redirect } {
pool EMDRA
} else {
pool $default_pool
}
}
The behavior remains the same: [LB::server pool] returns an empty string as long as I haven't set a pool explicitly by calling pool some_pool