Forum Discussion

CGI's avatar
CGI
Icon for Altostratus rankAltostratus
Nov 16, 2010

Combining geofiltering and uri filter

Hi we have a irule today that is below;this rule was created with help from this forum, i now need to be able to send traffic that reequests a certain url

 

 

 

IRULE:-

 

 

when CLIENT_ACCEPTED {

 

if {([class match [whereis [IP::client_addr] country] eq allowed_country] or [class match [IP::client_addr] eq allowed_ip])} {

 

set allowed 1 }

 

else { set allowed 0 }}

 

when HTTP_REQUEST {

 

if { $allowed eq 1 } {

 

Uncomment the line below to turn on logging.

 

log local0. "Valid client IP: [IP::client_addr]"

 

}

 

else {

 

HTTP::respond 403 content "The country or IP is not allowed to access this site"

 

log local0. "Blocked Country client IP: [IP::client_addr] from [whereis [IP::client_addr] country]" } }

 

 

such as http://at.nowhere.com/corp and comes from the UK to a different pool than those from Ireland.

 

 

Whats the best way to do this as regards both perofrmance and optimisation.

 

 

Any help greatly appreciated.

 

 

 

/Regards Craigg

 

1 Reply

  • Hi Craigg,

     

     

    If you're going to check a lot of URIs (or most of the HTTP requests that come into the VS will be checked for client IP GeoIP info) it would make sense to look up all client IP's once in CLIENT_ACCEPTED and then check the URI in HTTP_REQUEST. You could then select a pool based on GeoIP info and requested URI in HTTP_REQUEST.

     

     

    Aaron