GeoIP country blocking - whitelist specific IPs

Infinitnet nginx-forum at nginx.us
Mon Nov 12 20:02:55 UTC 2012


Hello NGINX users,

I'm facing a little issue with country bans over GeoIP. I'm using the
following code within my server directive:

if ($geoip_country_code ~ (BR|CN|KR|RU) ) {
return 123;
}

123 returns an error page informing the visitor that his country is blocked.
Now let's say I've got some visitors from russia, who should still be able
to access my website. How would I archive this? Of course something like
"allow 1.2.3.4;" doesn't work with the code above. Any suggestions? 

Thanks in advance!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,232745,232745#msg-232745



More information about the nginx mailing list