Forum Discussion
Converting iRule from v9 to v12
In the process of migrating from v9.4.7 to v12.1.1 and am having issues with iRules... In the following I am pulling string Data Groups for B2B_Blocked_URLS and B2B_URLS... Could you assist on how I would do this on the new version?
when RULE_INIT {
set ::DEFAULT_URI "/b2b/init.do"
}
when HTTP_REQUEST {
if { [matchclass [HTTP::uri] contains $::B2B_Blocked_URLS] } {
HTTP::redirect "$::DEFAULT_URI"
}
if { [matchclass [HTTP::uri] contains $::B2B_URLS] } {
} else {
log local0.crit [HTTP::uri] HTTP::redirect "$::DEFAULT_URI"
}
}
- Lee_Sutcliffe
Nacreous
Hi Jim,
You can try the following, please be advised you can now achieve the same results using a Traffic Policy (configured in the GUI). Code that is no longer supported are variables declared in the global namespace ($::var) these will demote your CMP so the iRule will only run on one CPU. Also matchclass has been deprecated
when RULE_INIT { set static::DEFAULT_URI "/b2b/init.do" } when HTTP_REQUEST { if {[class match [HTTP::uri] contains B2B_Blocked_URLS] } { HTTP::redirect $static::DEFAULT_URI } elseif { not ([class match [HTTP::uri] contains B2B_URLS]) } { log local0.crit [HTTP::uri] HTTP::redirect $static::DEFAULT_URI } }
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