Forum Discussion
Kalyan_Reddy_Da
Nimbostratus
Jul 28, 2010Help required in Irules for setting the FLAG
Hi Friends,
Need some help in the below irule. I have a irule whihc will cookie "ABCD" and if present some statements are executed which are CPU consuming and if condition is not met then it will gofor Header "TEST2" and if met it will execute that.
Out of my 100 requests i get 99 requests to "Header = TEST2" condition. But i need to check the first request in the same order (First Cookie ABCD and next Header TEST2). Once i am TRUE in Second loop Header = TEST2, all my corresponding requests should not go and check for HTTP Cookie ABCD. This is causing a lot of CPU Consumption.
I cant split the irule due to the architecture issues. Can anyone help in setting the FLAG that if i my request lands in HTTP Header = TEST2 then my next requests for this user login should not execute the HTTP Cookie "ABCD".
when HTTP_REQUEST {
if {([HTTP::cookie "TEST"] ne "") } {
pool p_pool1
}
elseif { [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
}
}
}
Anyones help is greatly appreciated
1 Reply
- Hamish
Cirrocumulus
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...
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
