Forum Discussion
msullivan_61147
May 26, 2010Nimbostratus
Here is the final code. It is working fine for me. My app sites are set to priority 25 or higher and persist on the JSESSIONID. My downtime sites have a priority of less than 25 and do not persist. Thanks Ian and Aaron for your code advice. Thanks also to Doug Lohf at F5 for helping tune this.
Michael
when HTTP_REQUEST {
Add a persistence record if the client presents a Java cookie with a value
if { [HTTP::cookie "JSESSIONID"] ne "" } {
persist uie [HTTP::cookie "JSESSIONID"]
}
}
when LB_SELECTED {
Track whether to add a persistence record in the response
set add_persist 1
Check if the current selected server is less than the main pool members' priority
if { [LB::server priority] < 25 } {
Don't add a persistence record in the response
set add_persist 0
Delete the persistence record
if { [HTTP::cookie "JSESSIONID"] ne "" } {
persist delete uie [HTTP::cookie "JSESSIONID"]
}
}
}
when HTTP_RESPONSE {
if { [HTTP::cookie "JSESSIONID"] ne "" && $add_persist} {
persist add uie [HTTP::cookie "JSESSIONID"]
}
if {($add_persist equals 0)} {
HTTP::close
}
}