Forum Discussion
AlanTen
Altostratus
Sep 04, 2015One-Way Persistence records problem
Hello All,
tl;dr - I have an iRule that is allowing HTTP_Request to insert invalid persistence records and unnecessary updates to existing persistence records and I would like to stop that by using...
Opher_Shachar_6
Nimbostratus
Sep 07, 2015Here is a cut down version of our persistence iRule.
It offers a more robust handling of persistence: * stale session cookie * no session cookie * allows debug logs (on persistence or request level) Weblogic Persist iRule, Version 0.93
Mars, 2012
Last update: Aug, 2012
Updated v11.6.0: 15/02/2015
Created by Opher Shachar (contact me through devcentral.f5.com)
Purpose:
This iRule persists requests based on the JSESSIONID cookie issued by the
Weblogic server.
when RULE_INIT {
Set debug level to: 0, 1 or 2
set static::Weblogic_debug 1
Set a timeout of 5.25 minutes (315 seconds)
set static::Weblogic_timeout 315
}
when CLIENT_ACCEPTED {
set log_prefix "Client [IP::client_addr]:[TCP::client_port]"
}
when HTTP_REQUEST {
Log details for the request
if {$static::Weblogic_debug > 1} {
log local0. "$log_prefix: Request to [HTTP::uri] with cookie: [HTTP::cookie value $static::Weblogic_CookieName]"
}
Check if there is a session cookie
set pkey [HTTP::cookie $static::Weblogic_CookieName]
Did we find a session id?
if {$pkey ne ""} {
Persist off of the session id value with the set timeout
if {[persist lookup uie $pkey] ne ""} {
persist uie $pkey $static::Weblogic_timeout
if {$static::Weblogic_debug > 1} {
log local0. "$log_prefix: Used persistence record from cookie or path: [persist lookup uie $pkey]"
}
} else {
Client gave stale session id -- don't persist
persist none
if {$static::Weblogic_debug > 0} {
log local0. "$log_prefix: No persistence record found for key: $pkey"
}
}
} else {
Client gave no session id -- don't persist
persist none
if {$static::Weblogic_debug > 1} {
log local0. "$log_prefix: No session id given in cookie or path."
}
}
}
when HTTP_RESPONSE {
Check if there is a session cookie in the response
set pkey [HTTP::cookie $static::Weblogic_CookieName]
Did we find a session id?
if {$pkey ne ""} {
Persist the session id value with the set timeout
persist add uie $pkey $static::Weblogic_timeout
if {$static::Weblogic_debug > 0} {
set val [persist lookup uie $pkey]
log local0. "$log_prefix: Added persistence record from cookie or redirect: $pkey -> $val"
}
}
}
Cut out are:
* persistence on JVMID alone (reduce persistence table size) * support for cookie-less user-agents * workaround for bug in pre-v11.1.0 HF2Help 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