Forum Discussion
iRule persitence on uri / payload
I am trying to set persistence using an iRule based on uri. The problem I think I might be having is related to the fact that the first uri that comes through does not contain the persistence string I want to use. When the iRule executes my page fails each time. this site does not use cookies
the url that contains my sessionid is as such - https://app.domain.com/AppName/con/...8346042343
where the 10.100.200.90.1308346042343 string is my sessionid
the iRule that I have in place (matches, but fails and kills my browser when used is
when CLIENT_ACCEPTED {
set add_persist 1
}
when HTTP_REQUEST {
set session_id [lindex [ split [HTTP::uri] "/" ] 3]
log local0. "Parsed a webapp sessionid as $session_id"
if { $session_id != "" } {
persist uie $session_id
}
}
A little more investigation I find that if I log the session to ltm I see the following sequence before my browser crashes and fails.
Jun 17 21:47:35 tmm tmm[1710]: Rule webapp-test2 : Parsed a webapp sessionid as
Jun 17 21:47:35 tmm tmm[1710]: Rule webapp-test2 : Parsed a webapp sessionid as 10.100.200.90.1308346445866
Jun 17 21:47:36 tmm tmm[1710]: Rule webapp-test2 : Parsed a webapp sessionid as 10.100.200.90.1308346445866
Jun 17 21:47:36 tmm tmm[1710]: Rule webapp-test2 : Parsed a webapp sessionid as 10.100.200.90.1308346445866
Jun 17 21:47:36 tmm tmm[1710]: Rule webapp-test2 : Parsed a webapp sessionid as 10.100.200.90.1308346445866
Interesting to note is that the first URI match is blank as it come from a dfferent pattern
https://app.domain.com/AppName/com?...tion=relay
and contains the session id in the body of the page itself
Jun 1HTTP/1.1 200 OK
8d
0
but does not contain the sessionid as being pull using the lindex split. Perhaps I need to throw that URL out somehow before capturing the string in the iRule, but how if so correct?
Any help is greatly appreciated
- HamishCirrocumulus
- HamishCirrocumulusOK...
- MattKirkevold_6NimbostratusHamish,
when CLIENT_ACCEPTED { set add_persist 1 } when RULE_INIT { set ::debug 0 } when HTTP_REQUEST { set cli [IP::remote_addr]:[TCP::remote_port] set session_id [lindex [ split [HTTP::uri] "/" ] 3] if {$::debug}{log local0. "Client: $cli Request session_id: >$session_id<"} if {$session_id != "" } { persist uie $session_id } } when LB_SELECTED { if {$::debug}{log local0. "Client: $cli LB to: [LB::server addr]"} } when HTTP_RESPONSE { HTTP::collect 1 set parse [ findstr [HTTP::payload] sessionid= 10 ] set session_id [split [lindex [split $parse] 0] " "] if {$::debug}{log local0. "Client: $cli Request session_id: >$session_id<"} if { $session_id != "" and $add_persist == 1 } { persist add uie $session_id } }
- hooleylistCirrostratusIf you have users connecting from behind the same proxy, you might get more than one session per TCP connection. If that's the case, then you'd probably want to check each response for a new session ID versus doing this just once per connection.
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