Forum Discussion
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
- hooleylistCirrostratusHi Craig,
when CLIENT_ACCEPTED { set cc [whereis [IP::client_addr] country] if { [class match $cc 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 } { switch $cc { "FI" - "DK" { if {[HTTP::uri] contains "/compass/" } { pool Compass${cc}_Test_http_pool } else { pool Compass_Test_http_pool } } default { 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" } }
- CGIAltostratusThanks Aaron that was much cleaner than the previous rule. /Craig
- CGIAltostratus
Hi Aaron it would seem that we have a problem with the application it needs the ports to be changed in the host header,and we use diiferent ports depending on the country.
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