Forum Discussion
Irule to Include Session-Persistence into /retail Instance
Hi,
Into the below Irule, the session persistence is mapped only with /storeperform extension, but now the requirement is to add the same rules even to /retail extension, kindly guide how I will modify the existing Irule.
when HTTP_REQUEST {
persist requests that start with /storeperform
if { [string tolower [HTTP::uri]] starts_with "/storeperform" } {
Check if there is a RpSemSessionID cookie in the request
if { [HTTP::cookie "RpSemSessionID"] ne "" } {
Persist off of the cookie value with a timeout of 1 hour (3600 seconds)
persist uie [string tolower [HTTP::cookie "RpSemSessionID"]] 3600
} else {
Parse the jsessionid from the query string
set jsess [findstr [string tolower [HTTP::query]] "rpsemsessionid=" 15 "&"]
Use the jsessionid from the path for persisting with a timeout of 1 hour (3600 seconds)
if { $jsess != "" } {
persist uie $jsess 3600
}
}
} else {
do not perist any other requests
persist none
}
}
when HTTP_RESPONSE { Check if there is a RpSemSessionID cookie in the response if { [HTTP::cookie "RpSemSessionID"] ne "" } { Add persistence record using cookie value with a timeout of 1 hour (3600 seconds) persist add uie [string tolower [HTTP::cookie "RpSemSessionID"]] 3600 } }
========================================
Kindly guide as I am starting out the concepts slowly with Irule.
Thanks and Regards Parveez
4 Replies
- Parveez_70209
Nimbostratus
Hi Team,
Kindly suggest how to include /retail into the existing Irule, which will enable sticky persistence even for /retail instance too( currently only /storeperform is configured)
Thanks and Regards Parveez
- nitass
Employee
can we just add one more uri in the if expression?
if { [string tolower [HTTP::uri]] starts_with "/storeperform" or [string tolower [HTTP::uri]] starts_with "/retail" } { - Parveez_70209
Nimbostratus
Hi Nitass,
Got you, how about the below, will it work ?
when HTTP_REQUEST { persist requests that start with /storeperform if { [string tolower [HTTP::uri]] starts_with "/storeperform" } { Check if there is a RpSemSessionID cookie in the request if { [HTTP::cookie "RpSemSessionID"] ne "" } { Persist off of the cookie value with a timeout of 1 hour (3600 seconds) persist uie [string tolower [HTTP::cookie "RpSemSessionID"]] 3600 } else { Parse the jsessionid from the query string set jsess [findstr [string tolower [HTTP::query]] "rpsemsessionid=" 15 "&"] Use the jsessionid from the path for persisting with a timeout of 1 hour (3600 seconds) if { $jsess != "" } { persist uie $jsess 3600 return } } } elseif { [string tolower [HTTP::uri]] starts_with "/retail" } { Check if there is a RpSemSessionID cookie in the request if { [HTTP::cookie "RpSemSessionID"] ne "" } { Persist off of the cookie value with a timeout of 1 hour (3600 seconds) persist uie [string tolower [HTTP::cookie "RpSemSessionID"]] 3600 } else { Parse the jsessionid from the query string set jsess [findstr [string tolower [HTTP::query]] "rpsemsessionid=" 15 "&"] Use the jsessionid from the path for persisting with a timeout of 1 hour (3600 seconds) if { $jsess != "" } { persist uie $jsess 3600 return } } } } when HTTP_RESPONSE { Check if there is a RpSemSessionID cookie in the response if { [HTTP::cookie "RpSemSessionID"] ne "" } { Add persistence record using cookie value with a timeout of 1 hour (3600 seconds) persist add uie [string tolower [HTTP::cookie "RpSemSessionID"]] 3600 } }
Thanks and Regards Parveez
- nitass
Employee
how about the below, will it work ?
since if-body is identical, why don't you just add the new uri to an existing if-expression?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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