geoip filtering not working

AJ Weber aweber at
Fri Aug 16 13:14:32 UTC 2013

I have this working pretty well (ok, I think _very_well_ ) with GeoIP.

I used a MAP in the main nginx.conf like this:
     map $geoip_country_code $allowed_country {
         default    0;

         US         1;
         GB         1;
         CA         1;
         EU         1;

Then, in my default.conf, the first statement(s) in the relevant 
"location's" is:

  if ($allowed_country = 0) {
             return 418;

Again, this works for me, and you can add "allowed countries" in just 
one place: the "map".


More information about the nginx mailing list