Forum Discussion

ask_me_anytime_'s avatar
ask_me_anytime_
Icon for Nimbostratus rankNimbostratus
Mar 16, 2009

Cooikie JsessionID persistence and Cookie Hash Profile

 

hello,

 

I'm thinking of using Cookie Hash Profile of LTM instead of the below code.

 

has anybody ever used Cookie Hash Profile to replace a JsessionID persistence ??

 

any strange behavoir when you used the Cookie Hash Profile ??

 

 

thanks ..

 

 

below is the code.

 

 

rule WeblogicJSessionPersist {

 

when HTTP_REQUEST {

 

if { [HTTP::cookie exists "JSessionID"] } {

 

persist uie [HTTP::cookie "JSessionID"]

 

} else {

 

set jsess [findstr [HTTP::uri] "JSessionID" 11 ";"]

 

if { $jsess != "" } {

 

persist uie $jsess

 

}

 

}

 

}

 

when HTTP_RESPONSE {

 

if { [HTTP::cookie exists "JSessionID"] } {

 

persist add uie [HTTP::cookie "JSessionID"]

 

}

 

}

 

}

 

5 Replies

  • James_Quinby_46's avatar
    James_Quinby_46
    Historic F5 Account
    Will the application break for users if the jsessionid is not honored? The iRule listed above is written to capture jsessionid from either a cookie or the URI and create a persistence record (via UIE) from it.
  • yes, with this irule, the application will break or the client connection will be forwarded to one of the pool members if the jsessionid is not honored.

     

     

    I'm thinking of using cookie hash profile instead of that irule but I'm not sure LTM cookie hash profile can work in this case....

     

    any suggestions ???
  • James_Quinby_46's avatar
    James_Quinby_46
    Historic F5 Account
    I'll confess that I've not ever used the cookie hash. Not recently, anyway. The jsessionid iRule works just fine. Even though it was originally written for WebLogic, I know it works very well with other java app servers (like tomcat, for example).

     

     

    There is a commented/annotated version of the same iRule here:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/Weblogic_JSessionID_Persistence.html

     

     

    If you leave the logging lines uncommented, you can test this out and see how it works. This version also includes a few "string tolower" statements to normalize all the strings to lowercase, in the off chance that the app throws "JSESSIONID" out there while it's also doing "jsessionid".

     

     

  • hi,

     

    thanks for the link.

     

    I will use that irule and implement cookie hash profile and see if it gives the same results.

     

    • fgf_165674's avatar
      fgf_165674
      Icon for Nimbostratus rankNimbostratus

      Hi,

       

      What was your result?

       

      Did you get the same results?

       

      Thank you