Jasa_74968
Mar 31, 2014Nimbostratus
Stop processing iRule by referencing a variable
I've set a variable in iRule named "stop_rule_processing" and its value is set to 1 if a particular iRule has a hit:
priority 300
when HTTP_REQUEST {
if { [string tolower [HTTP::path]] starts_with "/staging" } {
if { !([matchclass [IP::client_addr] equals IP_private_access])} {
log local0. "Source address [IP::client_addr] not from Private pool, session discarded" } {
discard
set stop_rule_processing 1
}
}
}
The other iRule check if that variable is set to 1 and if it is i want to use "event disable" stop rule processing immediately:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/staging*" {
log local0. "PreProd URL detected from [IP::client_addr] , sending to preprod pool"
pool PL-staging-pool
}
"/production*" {
log local0. "Prod URL detected [IP::client_addr] , sending to prod pool"
pool PL-production-pool
}
}
}
However I don't know how to check that variable at the beginning of second rule. I've tried to use multiple syntax versions of "if" command but can't get the syntax right.