01-Feb-2018
08:15
- last edited on
16-Dec-2022
00:16
by
JRahm
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"
}
}
01-Feb-2018
09:10
- last edited on
16-Dec-2022
00:17
by
JRahm
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
}
}