Forum Discussion
dave_it_25516
Nimbostratus
Aug 23, 2012Global Variables
If a global variable exist in an iRule and it is not applied to a Virtual Server, does it still have any affect on the F5 or the traffic.
Does a global variable need to be applied to a Virtual Host to...
nitass
Employee
Aug 25, 2012If a global variable exist in an iRule and it is not applied to a Virtual Server, does it still have any affect on the F5 or the traffic. no but you know if irule refers to the global variable, you will get no such variable error and connection will be reseted.
[root@ve10:Active] config b virtual bar list
virtual bar {
snat automap
pool foo
destination 172.28.19.79:80
ip protocol 6
rules myrule
profiles {
http {}
tcp {}
}
}
[root@ve10:Active] config b rule myrule list
rule myrule {
when HTTP_REQUEST {
log local0. "\$::test $::test"
}
}
[root@ve10:Active] config b rule myglobal list
rule myglobal {
when HTTP_REQUEST {
set ::test "hello world"
}
}
[root@ve10:Active] config curl -I http://172.28.19.79
curl: (52) Empty reply from server
[root@ve10:Active] config cat /var/log/ltm
Aug 25 18:57:33 local/tmm err tmm[4925]: 01220001:3: TCL error: myrule - can't read "::test": no such variable while executing "log local0. "\$::test $::test""
If a global variable exists in an iRule, does that variable only affect the Virtual Server it is applied to?no. it is visible globally.
Since this iRule exist and is applied to a Virtual Server, does that mean it would affect requests to a separate virtual host that doesn't have that iRule applied?no. global variable is just a variable which is globally accessible. traffic will be load-balanced based on virtual server configuration which handles that traffic.
hope this helps.
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