Forum Discussion
Kai_Wilke
Mar 09, 2016MVP
Hi Dean,
you may take a look to the two iRules below. They are outlining two different coding styles to achive what you've asked for...
"AND NOT with NE" Syntax
when CLIENT_ACCEPTED {
if { [set country [whereis [IP::client_addr]]] eq "" } then {
set country "empty"
}
}
when HTTP_REQUEST {
set redir [class match -value -- $country contains country-redirect]
if { ( $country eq "AU" ) and
( $redir ne "" ) and
( [URI::query [HTTP::uri] "pid"] ne "search" ) } then {
Do whatever you want...
} elseif { $redir ne "" } then {
HTTP::redirect $redir
} else {
HTTP::redirect "http://default.example.com/"
}
}
"AND with EQ" Syntax
when CLIENT_ACCEPTED {
if { [set country [whereis [IP::client_addr]]] eq "" } then {
set country "empty"
}
}
when HTTP_REQUEST {
set redir [class match -value -- $country contains country-redirect]
if { ( $country eq "AU" ) and
( $redir ne "" ) and not
( [URI::query [HTTP::uri] "pid"] eq "search" ) } then {
Do whatever you want...
} elseif { $redir ne "" } then {
HTTP::redirect $redir
} else {
HTTP::redirect "http://default.example.com/"
}
}
Cheers, Kai