GeoIP rewite rule?, redirect CHINA users to an error page.

CLIFFORD ILKAY clifford_ilkay at dinamis.com
Sun Feb 14 23:57:24 MSK 2010


On 02/14/2010 12:05 AM, David Taveras wrote:
> Hello,
>
> Iam wondering if somebody could help me out in applying the GeoIP
> module country variable for china so that if it matches redirect the
> user to an error page?

Hello,

This is straight from the site configuration of one of our clients. They 
decided which countries to block based upon past fraud statistics.

map $geoip_country_code $sb_allow {
     default yes;
     bg no;
     cn no;
     ee no;
     kr no;
     lv no;
     my no;
     ng no;
     ro no;
     ru no;
     th no;
     ua no;
     vn no;
}

server {
     listen 80;
...
     if ($sb_allow = no) {
         return 403;
     }
...
}
-- 
Regards,

Clifford Ilkay
Dinamis
1419-3266 Yonge St.
Toronto, ON
Canada  M4N 3P6

<http://dinamis.com>
+1 416-410-3326



More information about the nginx mailing list