Forum Discussion
MattC_58842
Nimbostratus
Dec 08, 2011Persistance in a I-rule
So I have this I-rule
when HTTP_REQUEST {
set uri [HTTP::uri]
switch $uri {
"/" { HTTP::redirect "https://[HTTP::host]/tf/WalletShare" }
"/tf/WalletShareREIT" { pool wdc-wshwstst-5002 }
"/tf/WalletShare" { pool wdc-wshwstst-5001 }
}
}
Once a connection comes in and hits the pool based off its uri , I want that connection to stick with that same pool no matter what is in the uri after the initial connection. I think my problem is as it builds the page different uri are created and its not being sent to the same pool
- hoolio
Cirrostratus
Hi Matt, - hoolio
Cirrostratus
Here's an example of what I was thinking. It uses a session cookie to track whether an initial pool selection has been made. Once a pool has been selected, a separate session cookie is used for persistence within the pool.when HTTP_REQUEST { Track whether to insert the pool selector cookie set insert_cookie 0 Check if there is a pool selector cookie switch [HTTP::cookie value pool_selector] { 1 { client already made a request so select the first pool pool wdc-wshwstst-5001 Use cookie insert persistence to ensure client is persisted to same member within this pool persist cookie insert pool5001 0 } 2 { client already made a request so select the second pool pool wdc-wshwstst-5002 Use cookie insert persistence to ensure client is persisted to same member within this pool persist cookie insert pool5002 0 } default { No cookie, so check the URI switch [HTTP::uri] { "/" { HTTP::redirect "https://[HTTP::host]/tf/WalletShare" } "/tf/WalletShareREIT" { pool wdc-wshwstst-5002 set insert_cookie 2 persist cookie insert pool5002 0 } "/tf/WalletShare" { pool wdc-wshwstst-5001 set insert_cookie 1 persist cookie insert pool5002 0 } } } } } when HTTP_RESPONSE { Check if we've made an initial pool selection for this request switch $insert_cookie { 1 - 2 { Insert the cookie in the response HTTP::cookie insert name pool_selector value $insert_cookie path / } } }
- nitass
Employee
just curious whether it works if we do HTTP::disable after selecting a pool in HTTP_REQUEST. - hoolio
Cirrostratus
I think calling HTTP::disable would only affect the current connection. So it wouldn't handle clients who make subsequent requests over a new TCP connection. And it would probably prevent a session cookie from being inserted into the response once a pool was selected for inter-pool persistence. Though I'm not sure Matt requires persistence within the pool. - nitass
Employee
thanks Aaron! i forgot about subsequential connections. - MattC_58842
Nimbostratus
Thanks guys I will try out sorry for late response , was caught up on a few calls yesterday. As always very appreciative for your time.
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