Forum Discussion
jwhitepnv_12764
Nimbostratus
Apr 12, 2005Persist based on a portion of SID
I have an application that returns URLs that look like this:
https://www.xyz.com/ires/en-us/html/SignIn?sid=JSNd.fstR2gz5Y.6&return-to=HomePage
The ".6" at the end of the "sid=" string u...
JRahm
Admin
Apr 13, 2005Assuming the sid=JSNd.fstR2gz5Y. is a static length before your Identifier of 6, and that the & is always the terminator, you can pull out the identifier and set it to a variable. Here's a start:
when HTTP_REQUEST {
if { [HTTP::cookie exists "persist_me"] } {
persist uie [HTTP::cookie "persist_me"]
}
}
when HTTP_RESPONSE {
set server_id [ findstr [HTTP::uri] "sid" 19 "&"]
You'll need logic here to compare the value of server_id
to the real server, and create new variable to insert into
cookie so when the HTTP_REQUEST is performed, no additional
processing will be required.
HTTP::cookie insert name persist_me value $server_id
}
If you just want to make sure you are persisting to the server responding, it might be easier to persist by extracting the responding server's information:
when HTTP_REQUEST {
if { [HTTP::cookie exists "persist_me"] {
set cookie_contents [HTTP::cookie persist_me]
set poolid [lindex cookie_contents 0]
set serverid [lindex cookie_contents 1]
set portid [lindex cookie_contents 2]
use pool $poolid member $serverid $portid
} else {
use pool $poolid
}
}
when HTTP_RESPONSE {
HTTP::cookie insert name persist_me value [LB::server]
}
Help 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
