Adam_24063
Mar 19, 2007Nimbostratus
persist based on cookie with URI pools
Howdy, I'm trying to take our working jsessionid iRule and add a twist. We'd like for requests with a .seam URI to go to one pool, while all other requests go to a different pool (the motivation here is to equal out expensive seam requests which treverse a Tomcat backend vs. simple JavaScript/JPGs/etc). Below is the working rule we use today:
rule jsessionid {
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] } {
persist add uie [HTTP::cookie "JSESSIONID"] 86400
}
}
when HTTP_REQUEST {
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"] 86400
if { [HTTP::uri] contains ".seam" } { log local0. "IP:[IP::remote_addr] URI:[HTTP::uri] NODE:[LB::server]" }
} else {
set jsess [findstr [HTTP::uri] ";jsessionid=" 12 32]
if { $jsess != "" } {
persist uie $jsess 86400
}
}
}
}
Along with the attempted new rule..
rule seam_persist {
when HTTP_RESPONSE {
if { [HTTP::cookie exists "JSESSIONID"] } {
persist add uie [HTTP::cookie "JSESSIONID"] 86400
}
}
when HTTP_REQUEST {
if { [HTTP::uri] ends_with ".seam" } {
pool www_seam
log local0. "POOL:seam IP:[IP::remote_addr] URI:[HTTP::uri] NODE:[LB::server]"
} else {
pool www
log local0. "POOL:www IP:[IP::remote_addr] URI:[HTTP::uri] NODE:[LB::server]"
}
if { [HTTP::cookie exists "JSESSIONID"] } {
persist uie [HTTP::cookie "JSESSIONID"] 86400
} else {
set jsess [findstr [HTTP::uri] ";jsessionid=" 12 32]
if { $jsess != "" } {
persist uie $jsess 86400
}
}
}
}
It should be noted the URI selection work fines, what we're running into is requests aren't being holding stickyness or persistence; this is obvious from navigating our application or logging LB::server. Thanks for the help!