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 have any affect on traffic?
If a global variable exists in an iRule, does that variable only affect the Virtual Server it is applied to?
Example. Virtual Host for example.com has an iRule applied to it that contains global variables set for pool selection based on what is contained in the "host" of the request.
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?
So would a request for qa.mysite.com be routed to a pool_qa_dest as declared in another iRule applied to the virtual server for example.com since the variable is global?
if { [string tolower [HTTP::host]] contains ".qa." } {
set poolDestination $::pool_qa_dest
} elseif { [string tolower [HTTP::host]] contains ".uat." } {
set poolDestination $::pool_uat_dest
} else {
set poolDestination $::pool_prod_dest
}
- nitass
Employee
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. 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""
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