Forum Discussion

Eric_Waite_1046's avatar
Eric_Waite_1046
Icon for Nimbostratus rankNimbostratus
Oct 02, 2006

persist jsession by uri

I know thi shas be gone over a whole bunch of times, and after alot of playing around I am using an example from a previous post:

 

 

What I need to accomplish is to persist by jsessionid, and jsession are only passed by the URI, example: http://beta.reading.com/reading/dispSchoolLogin.do;jsessionid=D0944F90E7592CC6ED780464716B6207

 

 

The following is written to the log file:

 

 

 

Mon Oct 2 14:40:13 EDT 2006 tmm tmm[989] Rule AppServerJsessionId HTTP_RESPONSE: jsessionid found, jsess is: 32EA5BBD8ACAAFACFC9239AC3F0F7541

 

Mon Oct 2 14:40:13 EDT 2006 tmm tmm[989] Rule AppServerJsessionId HTTP_REQUEST: Entering REQUEST, jsess is: 32EA5BBD8ACAAFACFC9239AC3F0F7541

 

Mon Oct 2 14:40:13 EDT 2006 tmm tmm[989] Rule AppServerJsessionId HTTP_REQUEST: Entering REQUEST, jsess is:

 

Mon Oct 2 14:40:13 EDT 2006 tmm tmm[989] Rule AppServerJsessionId HTTP_RESPONSE: jsessionid found, jsess is: 72EB37E2571E50803B07EE2B85CFE5FB

 

Mon Oct 2 14:40:13 EDT 2006 tmm tmm[989] Rule AppServerJsessionId HTTP_REQUEST: Entering REQUEST, jsess is: 72EB37E2571E50803B07EE2B85CFE5FB

 

 

The request is not being persisted to the client properly and it is throwig me to the wrong server.

 

 

Anyone have any suggestions?

 

 

 

 

when HTTP_REQUEST {

 

set uri [HTTP::uri]

 

set jsess [findstr $uri "jsessionid" 11 "?"]

 

log local0. "Entering REQUEST, jsess is: $jsess"

 

if { $jsess != "" } {

 

persist uie $jsess

 

}

 

}

 

 

when HTTP_RESPONSE {

 

if { [findstr $uri "jsessionid"] > 0}{

 

set jsess1 [findstr $uri "jsessionid" 11 "?"]

 

log local0. "jsessionid found, jsess is: $jsess1"

 

persist add uie $jsess1

 

}

 

}

 

 

Thank you.

 

 

Eric

2 Replies

  • 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..."
      }
    }
  • about the request is not being persisted to the client properly,

     

    i also found the same problem in my testing, is this a bug ?