GEOIP context problem

Maxim Dounin mdounin at mdounin.ru
Tue Aug 31 13:38:06 MSD 2010


Hello!

On Tue, Aug 31, 2010 at 12:18:13AM -0400, syle wrote:

> There is a problem with current 0.8.x release of GEOIP although I assume
> it has always not worked, where these variables:
> fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
> fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
> fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
> fastcgi_param GEOIP_REGION $geoip_region;
> fastcgi_param GEOIP_CITY $geoip_city;
> fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
> fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
> fastcgi_param GEOIP_LATITUDE $geoip_latitude;
> fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
> 
> do not work except inside the fastcgi_params file. The context is
> suppose to work within http as per module documentation however setting
> these variables
> within http context ends up not setting them at all.

Most likely you attempted to do something like

   http {
       fastcgi_param ...
       ...
       server {
           ...
           location ... {
               fastcgi_param ...
               ...
           }
       }
   }

This won't work due to inheritance rules for array-type 
directives, see here:

http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_param

"Directives set in current level clear any previously defined 
directives for the current level."

You have to define all fastcgi_param directives at the same level, 
i.e. 

   location ... {
       fastcgi_param ...
       fastcgi_param ...
       ...
   }

or

   http {
       fastcgi_param ...
       fastcgi_param ...
       ...
   }

Maxim Dounin



More information about the nginx mailing list