Optimizing Irule
Any suggestions for optimization appreciated.
when CLIENT_ACCEPTED {
if {([class match [whereis [IP::client_addr] country] eq Allowed_Country_Test] or [class match [IP::client_addr] eq allowed_ip])} {
set allowed 1 }
else { set allowed 0 }}
when HTTP_REQUEST {
if { $allowed } {
if {[whereis [IP::client_addr] country ] eq "FI" and [HTTP::uri] contains "/compass/" } {
pool CompassFI_Test_http_pool
} elseif {[whereis [IP::client_addr] country ] eq "DK" and [HTTP::uri] contains "/compass/" } {
pool CompassDK_Test_http_pool
} else {
pool Compass_Test_http_pool
}
} else {
do whatever you want to indicate the block, e.g.
HTTP::respond 403 content "The country or IP is not allowed to access this site"
}
}
/Craig