nginx geoip module with reverse proxy in multi tenant

Francis Daly francis at daoine.org
Sat Mar 27 09:54:29 UTC 2021


On Sat, Mar 27, 2021 at 04:09:29AM -0400, blason wrote:

Hi there,

> I need to implement geoip blocking but what I understood from the document
> is 
> map $geoip_country_code $allowed_country variable to has to be set in http
> section and then 
> if ($allowed_country = no) {
>   return 444;
>   }
> 
> Can be called in server section. This is fine if I am hosting one site what
> if in case of mutiple sites? In this case suppose 

  map $geoip_country_code $allowed_country_A {
  ...
  }

  map $geoip_country_code $allowed_country_B {
  ...
  }

  if ($allowed_country_A = no) {

http://nginx.org/r/map -- the second argument to "map" is whatever variable
name you choose.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list