I am using the session table to accomplish this:
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] } {
set jsessID [lindex [split [HTTP::cookie "JSESSIONID"] "!" ] 0 ]
if { [session lookup uie $jsessID] equals "" } {
session add uie $jsessID [IP::server_addr] 1800
log local0. "added server entry [session lookup uie $jsessID] for jsessionID $jsessID "
} else {
log local0. "existing server entry [session lookup uie $jsessID] for jsessionID $jsessID"
}
}
}
when HTTP_REQUEST {
if { [findstr [HTTP::uri] "jsessionid" 11 "!"] != ""} {
pool myApp-pool member [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"] ]
log local0. "jsessionID [findstr [HTTP::uri] "jsessionid" 11 "!"] sent to [session lookup uie [findstr [HTTP::uri] "jsessionid" 11 "!"] ]"
} else {
pool myApp-pool
log local0. "No jsession ID, local balancing the connection..."
}
}