Forum Discussion
Steven_Ruby_872
Nimbostratus
Dec 29, 2005jsession iRule and how to make http profile work
http://webserver/APP/x/goLogin;jsessionid=99EF9DBBA561A788043EF8A8D5FB20A5
does anyone have an iRule that would match this?
the current iRule i am using which i found on devcentral does not seem to work with the default http profile i am using. I see the traffic at the webservers yet the client never receives anything back thus the page never loads.
rule jsessionid {
when HTTP_REQUEST {
set uri [HTTP::uri]
set jsess [findstr $uri "jsessionid" 13 ")"]
log local0. "Entering REQUEST, jsess is: $jsess"
if { $jsess != "" } {
persist uie $jsess
}
}
when HTTP_RESPONSE {
if { [findstr $uri "jsessionid"] } {
set jsess1 [findstr $uri "jsessionid" 13 ")"]
log local0. "jsessionid found, jsess is: $jsess1"
persist add uie $jsess1
}
}
}
PROFILE fms HTTP parent: http
| virtual servers: fms.staging.wni.com
| requests (total, max, GET, POST) = (5, 1, 0, 0)
| requests (v0.9, v1.0, v1.1) = (5, 0, 0)
| responses (v0.9, v1.0, v1.1) = (0, 0, 0)
| responses (2xx, 3xx, 4xx, 5xx) = (0, 0, 0, 0)
| response size ( <1k, 1-4k, 4-16k, 16-32k, 32-64k)
| ( 0, 0, 0, 0, 0)
| Set-Cookie header insertions = 0
| adaptive parsing (2xx, 3xx) = (0, 0)
| compression: disabled
sr
4 Replies
- Colin_Walker_12Historic F5 AccountWell, the first thing that I would note is that you shouldn't need an HTTP_RESPONSE section. The persistence is set when the request is sent to the server. Once that is determined, the rest of that connection will continue to persist, as will any new connections with the information matching the persistence record which is, in this case, the jsessionid.
I'd try the rule again with only the HTTP_REQUEST section and see what results you get.
Don't forget you can use log statements to find what information the rule is processing in different sections.
HTH,
-Colin - Steven_Ruby_872
Nimbostratus
I am pretty sure the iRule will work, the problem i am having is that when i use the default http profile, the client never receives anything back.
here is the traffic path
client - VIP - node -
the traffic never seems to get back to client. If i turn off http profile which then also requires that i disable the jsession persistence profile and iRule, it is able communicate and the web app works properly. The problem with using a source_addr persistence is that some clients source_addr changes randomly during a session and i cant do anything about that, so i need the persistence to be based off the jsessionid.
sr - Steven_Ruby_872
Nimbostratus
i have used the following irule
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
}
}
This does seem to set the persistence, i see a rule in persist show all. But the persistence does not work, after moving around in the application i will randomly be taken back to a login prompt on another server in the pool.
Is there something else i need to be persisting on as once i am logged the jsessionid is no longer in the url?
sr - Steven_Ruby_872
Nimbostratus
here is where i am now.
when HTTP_REQUEST {
set jsess [findstr [HTTP::uri] "jsessionid" 11]
if { $jsess != "" } {
log local0. "Entering REQUEST, jsess is: $jsess"
persist uie $jsess
}
}
when HTTP_RESPONSE {
set cookie [HTTP::cookie "JSESSIONID"]
if { [HTTP::cookie exists "JSESSIONID"] } {
persist add uie [HTTP::cookie "JSESSIONID"]
log local0. "Request received: $cookie"
}
}
here are the logs:
Jan 13 12:07:37 tmm tmm[720]: Rule fmsjessionid : Request received: 20F7EFC482475B8E8A622EB5462C4932
Jan 13 12:07:37 tmm tmm[720]: Rule fmsjessionid : Entering REQUEST, jsess is: 20F7EFC482475B8E8A622EB5462C4932
Jan 13 12:07:51 tmm tmm[720]: Rule fmsjessionid : Request received: 92D0B71F1870A101508225A86763BC4E
you see the first 2 have the same jsessionid and then once in the application it hops over to the other server and a new cookie is giving out.
the persistence is setup as you see here:
Mode: universal Value: 20F7EFC482475B8E8A622EB5462C4932
Virtual: vip:https Node: node:https Age: 143sec
sr
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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