Forum Discussion
Robert_47833
Altostratus
Jul 09, 2011difference between set ::domain ".cjj.com" and $::domain
Hi,all
I am confused by global variable
see below
set :: domain "cjj.com"
set $::domain "cjj.com"
set static::domain "cjj.com"
I am confused by the type of global variable and which can disable CMP in v10
7 Replies
- Colin_Walker_12Historic F5 AccountFor CMP compliance in v10, you'll want to use :
set statice::domain "cjj.com"
Colin - hoolio
Cirrostratus
Any variable set in RULE_INIT will be global in scope. So 'set ::domain "cjj.com"' and 'set domain "cjj.com"' if run in RULE_INIT will be equivalent. Both will demote the VS from CMP.
As Colin suggested, for variables which don't need to be changed over the course of a connection, you can use the static:: namespace. This gives you a variable which is global in scope but preserves CMP compatibility. You can get more info on CMP here:
http://devcentral.f5.com/wiki/default.aspx/iRules/CMPCompatibility.html
http://devcentral.f5.com/wiki/default.aspx/iRules/static
Aaron - Colin_Walker_12Historic F5 AccountAs the links Aaron shared touch on briefly, it's also possible to use things like the session table or table command to avoid need for global variables entirely, depending on what you're trying to do. This is often a great route as it's high performance and fully CMP compliant.
Colin - Robert_47833
Altostratus
Hi,all
thanks for all your support
1: if {[class match $uri starts_with cjj]} {
pool SRWD29-BROWSE
2:if {[matchclass [IP::remote_addr] equals $::cjj]} {
HTTP::redirect "https://bpm.stubprod.com"
pls see,cjj is a datagroup.
what is the difference between 1 and 2
$::cjj WILL disable CMP,can I change it to cjj in 2? - hoolio
Cirrostratus
If cjj is a datagroup then you'd want to remove the $:: prefix on 9.4.4 or higher to preserve CMP compatibility. If you're on 10.x, you should use the class command instead of matchclass/findclass as it's more efficient and functional.
Aaron - Robert_47833
Altostratus
Hi,Aaron
I am on 10.x,so I need to remove $:: and use class instead of matchclass/findclass,right? - hoolio
Cirrostratus
That's exactly it.
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
