Forum Discussion
MattKirkevold_6
Jun 17, 2011Nimbostratus
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...
MattKirkevold_6
Jun 20, 2011Nimbostratus
Hamish,
Thanks for the replies, greatly appreciated.
I think part of this is related to the browser starting a java applet (more info to me) and that session is what needs to persist. This would crash out either FF or IE. I did a birt more research and was also pointed to the following that did the trick.
http://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/160/iRules-persist-v-persist-add.aspx
By setting the pesist add is the RESPONSE section I was able to then use the general persist in the REQUEST. Because the REQUEST and RESPONSE have difference in representing the sessionid I used 2 different mthods to retrieve the sessionid. This tested out and worked.
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
}
}
-Matt
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