Forum Discussion

_Tom991's avatar
_Tom991
Icon for Nimbostratus rankNimbostratus
Mar 18, 2021

JSESSIONID Persistance based on jsessionid in URL

Hi!

I've been asked to have a look at problem with passing jsessionid in the url in our apache tomcat. I'm trying to re-create stickysession from mod_proxy:

stickysession - Balancer sticky session name. The value is usually set to something like JSESSIONID or PHPSESSIONID, and it depends on the backend application server that support sessions. If the backend application server uses different name for cookies and url encoded id (like servlet containers) use | to separate them. The first part is for the cookie the second for the path.

iRule used from https://devcentral.f5.com/s/articles/weblogic-jsessionid-persistence

when HTTP_REQUEST {
  if { [HTTP::cookie "JSESSIONID"] ne "" }{
   persist uie [string tolower [HTTP::cookie "JSESSIONID"]] 3600

  } else {
   set jsess [findstr [string tolower [HTTP::path]] "jsessionid=" 11]
   if { $jsess != "" } {
     persist uie $jsess 3600
   }
  }
}
when HTTP_RESPONSE {
  if { [HTTP::cookie "JSESSIONID"] ne "" }{
   persist add uie [string tolower [HTTP::cookie "JSESSIONID"]] 3600
  }
}

Basically I follow the instructions as stated in document but for some reason ;jsessionid= dissapears from URL (works with cookie hash)

  1. Create iRule
  2. Create Universal Profile with iRule attached to it + Match across services
  3. Attach HTTP profile + Universal Profile + OneConnect

Currently VIP is using cookie hash persistance with oneconnect, JSESSIONID cookie name and ;jsessionid= is present in URL

Could you please give me some ideas why sessionid is not passed into URL when iRule and Universal Profile is used or is there easier way to perform this task?

What I'm trying to accomplish:

http:// test.ad/;jsessionid=C8B1AA1CE3D16DB83DAF8300E1779277.gui145

and the cookie should be:

JSESSIONID=C8B1AA1CE3D16DB83DAF8300E1779277.gui145

2 Replies