Forum Discussion
Bubbagump_12531
Mar 21, 2013Nimbostratus
Ok, so I am not sure how global variables work in F5. How do I call $static::pool in other iRules and then what is the scope of that variable? So long as it is active under the VirtualServer will all iRules inherit/understand the value given to static::pool?
So my thinking is under the virtual server I have an iRule:
root@ve10:Active] config b rule GlobalSwitch list
rule GlobalSwitch {
when RULE_INIT {
set static::pool A
}
Then in say all of my 100 other various other iRules I can say?
when HTTP_REQUEST {
if { ([HTTP::host] matches "www.siteabc.com")} {
pool /Common/pool_Ruby_$static::pool
}
}
And they will inherit the value given in the above "GlobalSwitch" iRule?
Am I understanding correctly?
Do I even need to bind the global variable iRule to anything? This:
https://devcentral.f5.com/wiki/irules.RULE_INIT.ashx
leads me to believe that I just need to define it and not bind it to anything.
Thanks!