Forum Discussion
lanceleroux_533
Nimbostratus
Sep 04, 2008JSessionID URI Persist
I have created an IRULE to do URI JSessionID balancing for the application only (/mosAppWar)
So far our server and LTM logs indicate that this is not being respected.
Anyone have any ideas as to what I am doing wrong?
Thank you,
IRULE:
when HTTP_REQUEST {
if { [HTTP::uri] contains "/mosAppWar" }{
set jsess [findstr [HTTP::uri] "jsessionid" 11 ";"]
if { $jsess != "" } {
persist uie $jsess
}
pool Application_Pool
log local0. "QA2 Server: [LB::server addr] jsessionid $jsess Query: [HTTP::uri][HTTP::query]"
return
}
else {
pool Static_Pool
return
}
}
LOGS:
Sep 4 11:26:08Server: 10.70.10.84 jsessionid B2058030EE36EC09B45C.2 Query: /mosAppWar/MosSystem/AJAXDispatching;jsessionid=B2058030EE36EC09B45C.2pgIWorkQueue_btProceed=loadtarget
Sep 4 11:26:08Server: 10.70.10.78 jsessionid B2058030EE36EC09B45C.2 Query: /mosAppWar/MosSystem/AJAXDispatching;jsessionid=B2058030EE36EC09B45C.2pgIWorkQueue_btProceed=loadtarget
Sep 4 11:26:08Server: 10.70.10.78 jsessionid B2058030EE36EC09B45C.2 Query: /mosAppWar/MosSystem/AJAXDispatching;jsessionid=B2058030EE36EC09B45C.2pgIWorkQueue_btProceed=loadtarget
- Nicolas_Menant
Employee
Hi, - lanceleroux_533
Nimbostratus
The weird thing is that I never see any records for jsessionid in the table. I have confirmed that the rule is running since it is logging to my syslog server. - Nicolas_Menant
Employee
Can you try this:when HTTP_REQUEST { if { [HTTP::uri] contains "/mosAppWar" }{ set jsess [findstr [HTTP::uri] "jsessionid" 11 ";"] if { $jsess ne "" } { log local0. "creating persistency with $jsess" persist uie $jsess } pool Application_Pool log local0. "QA2 Server: [LB::server addr] jsessionid $jsess Query: [HTTP::uri][HTTP::query]" return } else { pool Static_Pool return } }
- lanceleroux_533
Nimbostratus
I have changed my IRULE and also have the output (See attachment). - Nicolas_Menant
Employee
it seems like your ending caracter for the findstr command may be ? or ; - hoolio
Cirrostratus
It looks like the findstr isn't set correctly. Can you add a new log line of just the URI or just reply with a few examples? - lanceleroux_533
Nimbostratus
Even though it looks better. I am still not completely sure it is working right. - lanceleroux_533
Nimbostratus
Would the fact that some requests have no JSessionID mess UIE up? even though these types of requests don't need persistence? - Nicolas_Menant
Employee
it shouldn't messed up the application, why do you say you're not sure it's completely right ? - lanceleroux_533
Nimbostratus
Some of the entries in the table were showing uri instead of jsessionid. I think that is because of the the application doesn't use jsessionids. I have improved the code to keep the LTM from adding the bad entries to the table.when HTTP_REQUEST { if { [HTTP::uri] contains "/mosAppWar" }{ Make jsess equal the jsessionid set jsess [findstr [HTTP::uri] "jsessionid" 11 "."] Make sure that jsessionid is actually there since some requests don't have one. if {[HTTP::uri] matches_regex {jsessionid} } { Make sure jsessionid is not blank before adding it to the UIE. if { $jsess ne "" } { Commit the record to the LTM database for 5400 seconds. persist uie $jsess 5400 } } Since it is /mosAppWar send the host to the application pool. pool CIBC_Express_Application_Pool log local0. "QA2 Server: [LB::server addr] jsessionid $jsess Query: [HTTP::uri][HTTP::query]" log local0. "URI: [HTTP::uri][HTTP::query]" return Send all other requests to the static pool. } else { pool CIBC_Express_Static_Pool return } }
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects