Forum Discussion
Joe_Hsy_45207
Nimbostratus
Nov 20, 2007how to detect potential conflict with other iRule?
Hi,
We have a tool which uses iControl to dynamically add an iRule to a virtual server and it is important to ensure that the iRule we add do not conflict with existing iRules (or other iRul...
Nov 20, 2007
There is no built in way to determine this but you can add the logic to your iRules with session variables.
The following iRule has two HTTP_REQUEST events with different priorities. The lower priority (100) will execute first. In the first iRule, I set a session variable ALREADY_RESPONDED to 1.
iRule 1:
when HTTP_REQUEST priority 100 {
set ALREADY_RESPONDED 1
HTTP::redirect "http://www.foo.com"
}In the second iRule, check to see if that ALREADY_RESPONDED variable has be set to anything using the "info exists" command. This is basically equivalent to a "is not null" comparison.
iRule 2:
when HTTP_REQUEST priority 200 {
if { ![info exists ALREADY_RESPONDED] } {
HTTP response not yet sent, continuing with iRule...
}
}Keep in mind that for keep-alive connections, you may have to "unset" the variable in the last iRule in the chain so that future HTTP requests over the same connection don't inherit the session variable from the previous request.
-Joe
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
