Forum Discussion
JSESSIONID's with null or empty values
Hi Aaron. Yeah, I modified the rule with the above updates and still generate a Tcl error:
TCL error: jsessionid_persist_v2_rule - Illegal value (line 1) invoked from within "persist add uie [HTTP::cookie "JSESSIONID"] 2700"
I then added a simple logging statement to see what the value of the JSessionID was in the HTTP Response, so the HTTP_RESPONSE portion of the rule looks like this:
when HTTP_RESPONSE {
Check if the JSESSIONID cookie is present in the response and has a non-null value
if { [HTTP::cookie "JSESSIONID"] ne "" }{
log local0. "JSessionID in Response: [HTTP::cookie "JSESSIONID"]"
Persist on the JSESSIONID cookie value for X seconds
persist add uie [HTTP::cookie "JSESSIONID"] 2700
}
}
This logged the jsessionid in the response on successes, giving me entries like the following:
timestamp: Rule jsessionid_persist_v2_rule : JSessionID in Response: 0C854B89214B1BBE792C37EED980226B.app1
timestamp: Rule jsessionid_persist_v2_rule : JSessionID in Response: CF1D39BD092A170227817B907D6E6128.app2
But in my responses where the jsessionid was supposed to be empty, I was still getting the Tcl error like above. So, then for no particular reason, I added an else clause to persist none like so:
when HTTP_RESPONSE {
Check if the JSESSIONID cookie is present in the response and has a non-null value
if { [HTTP::cookie "JSESSIONID"] ne "" }{
log local0. "JSessionID in Response: [HTTP::cookie "JSESSIONID"]"
Persist on the JSESSIONID cookie value for X seconds
persist add uie [HTTP::cookie "JSESSIONID"] 2700
} else {
persist none
}
}
Although this did not help with my problem, the one thing it did do was log the value of the jsessionid in the response before logging the Tcl error:
timestamp: Rule jsessionid_persist_v2_rule : JSessionID in Response: ""
In my log where I'm simply logging the jsessionid, I'm logging the literal jsessionid, which is to be expected, without any surrounding quotes. In the log entry directly above where I'm supposedly logging an empty jsessionid, I think that Tcl on the ltm is literally setting the JSessionID to two double quotes: "", which might explain why my ' If JSessionID is not equal to "" ' does not appear to be working on empty jsessionid values.
Recent Discussions
Related Content
* 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