Forum Discussion
Robert_47833
Altostratus
Jul 04, 2011need help in forward uri to different pool via specific percentage
I have two pool: cjj1 ,cjj2
1:for uri in data group aaa, send 80% request to cjj1 and 20% to cjj2
2:if one client visit cjj1,all other requests from this client should be sent to cjj1,so I think we should do cookie persisit here
how to achieve this via irule.
we suppose the new cookie is ttttttt
thanks very much
- hoolio
Cirrostratus
Hi Jucao, - Robert_47833
Altostratus
Hi,dear hoolio - hoolio
Cirrostratus
Hi Jucao,when HTTP_REQUEST { Track whether to set a cookie to force use of the cjj1 pool set cjj1_cookie 0 Check if request already has a cookie indicating they should be sent to the cjj1 pool if {[HTTP::cookie value cjj1_cookie] == 1}{ Select the cjj1 pool pool cjj1_pool Exit this event in this rule return } If we got here, request did not have a pool selector cookie if {[class match [HTTP::uri] starts_with cjj1_uri_class]}{ if { rand() < 0.20 } { Select the cjj1 pool pool cjj1_pool Track whether to set a cookie to force use of the cjj1 pool set cjj1_cookie 1 } Default action if a pool was not selected above will be to use the VS default pool } } when HTTP_RESPONSE { Check if request was for a cjj1 URI if { $cjj1_cookie == 1 }{ Insert a session cookie in the response HTTP::cookie insert cjj1_cookie value 1 path "/" } }
- Robert_47833
Altostratus
hI,I have worked out,but still need to confirm with u in some details - hoolio
Cirrostratus
If you set an expire time of something other than 0 on the cookie it should be saved by the client on the filesystem and sent on each request until it expires. If you don't set an expire time or set it to 0, then the client should store it in memory and not send it after the browser is closed. - hoolio
Cirrostratus
If you set an expire time of something other than 0 on the cookie it should be saved by the client on the filesystem and sent on each request until it expires. If you don't set an expire time or set it to 0, then the client should store it in memory and not send it after the browser is closed. - Robert_47833
Altostratus
Hi,Hoolio
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