Forum Discussion
Hamish
Jul 29, 2010Cirrocumulus
On a connection basis it's easy...
when CLIENT_ACCEPTED {
set testflag 1
}
when HTTP_REQUEST {
if {([HTTP::cookie "TEST"] ne "") } {
pool p_pool1
} elseif { $testflag equals 1 } {
if { [HTTP::cookie "ABCD"] contains "app1l" } {
if { ([HTTP::uri] starts_with "/apps/admin/") } {
Execute some statements. whihc are very much CPU consuming.
} elseif {[HTTP::header "TEST2"] ne "" } {
Execute some statements.
pool p_pool2
set testflag 0
}
}
}
}
However if you want this by USER instead, then instead of using a hard-coded variable per connection (testflag), write the testflag to a session cookie and pull the value (Or if you have a cookie with the username in it, you could keep a table of users and their flags, but that assumes each user will only ever get the processing done once for all their parallel logins... That may be what you want, or not).
YMMV...