Forum Discussion
Jun 16, 2011
Are there functions or methods we can create using IRules?
Hello Community,
I have multiple IRules associated to a VS and was wondering if there can be IRules or methods/functions that we can create and call them ONLY when we want? Or does all the IRules MUST be executed in a top down fashion?
Example of IRule order used by a VS:
IRule 1
IRule 2
IRule 3
IRule 4
Is there way to call IRule 3 and skip IRule 2 from IRule 1?
Or just call a method/function from IRule 4 from IRule 1 then end the session?
Regards,
TRX
1 Reply
- hoolio
Cirrostratus
Hi TRX,
You can disable events using 'event < name > disable' but that affects all iRules on the virtual server which reference that event. I think the best solution is to use one or more local variables to track which code you want to run. A local variable is accessible across all iRules on the same virtual server on a per connection basis. So you can use something like:
rule1 - set run_rule3 1
rule2 - set run_rule3 0
rule3 - if {$run_rule3 == 1}{ do something}
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