Forum Discussion
Local variable used in more iRules but in one VIP - is it shared among VIP iRules?
Hi,
I am thinking about using variable in the way - when I enable some action (redirect), then another actions (another redirects) in another rules will be disabled.
All these are using different iRules, but they are attached to the same VIP.
I was thinking about static variable, but now it seems that it could work also with simple local variable because it is shared within the session?
Am I right? Please comment who knows more, thank you a lot..
Zdenek
3 Replies
- Kevin_Stewart
Employee
When multiple iRules are applied to a virtual server their events are combined, sometimes in an order that you didn't intend. The first thing I would recommend is using the priority tag in the event declarations to guarantee order. As for using a single local variable across iRules, in the same VIP, yes it should work but it's probably not the safest thing to do. If you're going to do this, I highly recommend that you apply [info exists ] checks and catch clauses where appropriate. - Zdenda
Cirrus
Sorry, but could you paste some example please? I am not sure how I should appy that [ info exists]?
Thanks,
Zdenek
- What_Lies_Bene1
Cirrostratus
Here's an example of checking that a variable exists;if { [info exists lookup] and $lookup == 1 } { ... Note no $ symbol is used for the variable name with info as you are not referencing the variable value
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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