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...
hoolio
Cirrostratus
Dec 08, 2011Here'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.
Make sure to test with a OneConnect profile enabled on the virtual server. If you're using serverside source address translation, you can use the default OneConnect profile with a /0 source mask. Else, use a custom OneConnect profile with a /32 source mask.
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 /
}
}
}
Aaron
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
