Forum Discussion
MarcoP
Jul 20, 2022Nimbostratus
iRule with JSESSIONID including the server id with jvmRoute
Dears, unfortunately I did not find a fitting post to my problem: We have two or more servers they creating a JSESSIONID where the id of the server is added on the end like so: 7B0DE3926CF23C2...
xuwen
Jul 20, 2022Cumulonimbus
plan C:
Creating the universal persistence profile
To create a universal persistence profile and reference the persistence iRule you created in the previous procedure, perform the following procedure:
- Log in to the Configuration utility.
- Navigate to Local Traffic > Profiles.
- From the Persistence menu, click Create.
- Type a name for the universal persistence profile.
- For Persistence, click Universal.
- For Configuration, select the iRule check box, then click the persistence iRule you created.
- Click Finished.
iRules code:
when HTTP_RESPONSE priority 500 {
if { [HTTP::cookie exists "JSESSIONID"] } {
# serverID0,serverID1, length is 9
set node_x [findstr [HTTP::cookie "JSESSIONID"] "serverID" 0 9]
log local0. "node_x is $node_x"
# persist add uie, key is serverIDX, timeout is 1800s
persist add uie $node_x 1800
}
}
when HTTP_REQUEST priority 500 {
if { [HTTP::cookie exists "JSESSIONID"] } {
set server_x [findstr [HTTP::cookie "JSESSIONID"] "serverID" 0 9]
set value [persist lookup uie $server_x]
if { $value != "" } {
persist uie $server_x
}
}
}
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