Forum Discussion
persisting different clients to same server based on where the process is started
This may not even be remotely what you're looking for, but take a look at this:
when HTTP_REQUEST {
log local0. "requesting [HTTP::uri]"
if { ( [HTTP::method] equals "POST" ) and ( [string tolower [HTTP::uri]] equals "/soapcall.php" ) } {
set catch_clientid 1
} elseif { [string tolower [HTTP::uri]] starts_with "/secondrequest" } {
set clientid [URI::query [HTTP::uri] clientid]
set persistTo [session lookup uie $clientid]
log local0. "persisting to $persistTo"
pool [LB::server pool] member $persistTo
}
}
when HTTP_RESPONSE {
if { [info exists catch_clientid] } {
unset catch_clientid
set clientid [URI::query "?[HTTP::header Location]" clientid]
log local0. "setting persistence for $clientid to server [LB::server addr]"
session add uie $clientid [LB::server addr]
}
}
I also didn't have your environment to work with, so I generated a simple web page that immediately redirected me to another with a query string (ex. ?clientid=1234567890). I post to the first page (/soapcall.php), which sets a flag variable. On response from the soapcall page, the HTTP_RESPONSE event grabs the clientid (mine is in the Location header but yours could be somewhere in the payload), creates a session entry based on the clientid, and stores the selected LB server. When the client makes a subsequent GET request with the clientid query string, I look up the LB server data from the session table and pool to that member. This of course works as long as the client is sending the clientid in the query string.
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