Forum Discussion
- zaferJul 08, 2019Nimbostratus
Hi,
can i use "persist none" command in content switch irule for disable persistence when i use another irule for jsessionid persistence (i don't use persistence profile)
- JRahmJul 08, 2019Admin
Yes, if you include a conditional on when you want to persist and when you don't, this should work fine. You can see an example here: https://devcentral.f5.com/s/articles/weblogic-persistence-done-right
- zaferJul 08, 2019Nimbostratus
Hi Jason,
here is the our rules, app team tested and they say still persisted and "persist none" didn't work.
i opened case and support does not help us.
Switch_irule
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] request to [HTTP::host][HTTP::uri]"
switch -glob [HTTP::uri] {
"/uat/JAVA*" {
pool Persist_Test_Pool_1
HTTP::uri [string map -nocase {"/uat/JAVA" "/JAVA"} [HTTP::uri]]
log local0. "[IP::client_addr]:[TCP::client_port]: matched [HTTP::uri]. Pool: [LB::server]"
}
"/uat/abc/*” {
pool Persist_Test_Pool_2
persist none
HTTP::uri [string map -nocase {"/uat/abc/“ “/test/“} [HTTP::uri]]
log local0. "[IP::client_addr]:[TCP::client_port]: matched [HTTP::uri]. Pool: [LB::server]"
}
"default" {
log local0. "[IP::client_addr]:[TCP::client_port]: matched [HTTP::uri]. Pool: [LB::server]"
log local0. "No match"
}
}
}
Jsessionid_rule
when HTTP_REQUEST {
# Log details for the request
set log_prefix "[IP::client_addr]:[TCP::client_port]"
log local0. "$log_prefix: Request to [HTTP::uri] with cookie: [HTTP::cookie value JSESSIONID]"
# only header cookie control
if { [HTTP::header exists "Cookie"] } {
set jsess [findstr [string tolower [HTTP::header "Cookie"]] "jsessionid=" "11" "." ]
if { $jsess != "" } {
persist uie $jsess 3600
log local0. "$log_prefix: Used persistence record from path: [persist lookup uie $jsess] $jsess"
}
}
}
when HTTP_RESPONSE {
if { [HTTP::header exists "Set-Cookie"] } {
set jsess [findstr [string tolower [HTTP::header "Set-Cookie"]] "jsessionid=" "11" "." ]
if { $jsess != "" } {
persist add uie $jsess 3600
log local0. "$log_prefix: Added persistence record from cookie: [persist lookup uie $jsess] $jsess"
}
}
}
- JRahmJul 08, 2019Admin
order will be important since your irules are separate. You will either want to combine your rules into one and make sure your logic is correctly ordered, or you need to set the order in the GUI or set a priority on each irule to make sure your switch rule comes after your persistence rule.
Given how simple both rules are, however, I highly recommend combining them reduce complexity.