Forum Discussion

JCMATTOS_41723's avatar
JCMATTOS_41723
Icon for Nimbostratus rankNimbostratus
May 13, 2009

Problems with persistence and JSESSIONID?

I have gone thru the forums and samples and tried different variations of irules to enable persistence with a JSESSIONID cookie. And I can't seem to get it to stick. I've gone thru packet captures and HTTP analyzers and have confirmed that the cookie is present and being passthru normally, but yet it doesn't seem to stick to one server. We have dual LTM's 8400 with 9.4.3 and we are loadbalancing a multi-tierd webproxy/app (webshpere) thru the F5 which looks something like this: (and an example of the cookie)

 

Cookie:JSESSIONID=0000Lw0zPkqZ66ejLdPuflVBf3Q:-1

 

CLIENT

 

/\

 

F5

 

/\

 

RP1 RP2 (Reverse Proxy Tier)

 

\ /

 

F5

 

/\

 

AP1 AP2 (Webshpere Application)

 

I used variations of the JSESSION sample along with others with no luck...Am I missing something? Any help is greatly appreciated? Thx!

 

when HTTP_REQUEST {

 

if { [string length [HTTP::cookie exists "JSESSIONID"]] } {

 

persist uie [HTTP::cookie "JSESSIONID"] 3600

 

} else {

 

set jsess [findstr [string tolower [HTTP::path]] "jsessionid=" 11]

 

if { $jsess != "" } {

 

persist uie $jsess 3600

 

}

 

}

 

}

 

when HTTP_RESPONSE {

 

if { [string length [HTTP::cookie exists "JSESSIONID"]] } {

 

persist uie [HTTP::cookie "JSESSIONID"] 3600

 

}

 

}

3 Replies

  • Do you have universal persistence profile assigned to the virtual address?
  • Thx CM! I do have universal persistence profile enabled, not sure if it's setup right...but initially i had the irule enabled separately not in the universal profile. I did try enabling the irule in the universal profile as well. Still no sticky. I can see from a tcpdump on the F5 I'm still using both legs. Is there anything else?
  • I have seen situations where the server id numbers after the jsessionID change, which would create a different persistence record. To combat that, just strip out the jsessionID from the cookie:

     
     when HTTP_REQUEST { 
       if { ![HTTP::header exists "jsessionid"] } { 
         set jsess_uri [findstr [HTTP::uri] "jsessionid" 11 "!"] 
         if { $jsess_uri != "" } { 
           persist uie $jsess_uri 3600 
         } 
       } 
     } 
     when HTTP_RESPONSE {  
       if { [HTTP::header exists "jsessionid"] } {  
         set jsessID [findstr [HTTP::header "jsessionid"] "!" 1 "!"]  
         if { $jsessID != "" } {  
           persist add uie $jsessID 3600 
         }  
       }  
     } 
     

    you might have to tweak this, I haven't tested jsession stuff in months and no longer have access to do so anyway. HTH