Welcome! Log In Create A New Profile

Advanced

Re: geoip_country_code header is deleted when I set another custom header

Ruslan Ermilov
January 10, 2014 05:40AM
On Fri, Jan 10, 2014 at 04:40:00AM -0500, MarcPapers wrote:
[...]
> location / {
> proxy_pass http://xx;
> access_log /var/log/nginx/xx.access.log menosbasico;
> proxy_set_header ismobiletraffic $mobile_flag;
> }
>
> ## END DEFAULT FILE ##
>
> The proxy_set_header directive for geoip is placed in nginx.conf
>
> ## BEGIN NGINX.CONF ##
>
> ...
> ...
>
> http {
> access_log /var/log/nginx/access.log;
> error_log /var/log/nginx/error.log;
> rewrite_log on;
>
> proxy_set_header X-Forwarded-For $remote_addr;
>
> geoip_country /usr/share/GeoIP/GeoIP.dat;
> proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;
>
> ...
> ...
>
> ## END NGINX.CONF ##
>
> The problem is that now, the ismobiletraffic header is set correctly, but
> the geoip headers have disspeared from the request. Seems to have been
> overwritten. Should I place the mobile traffic detection on NGINX.CONF at
> http{ } level? I have been looking for a solution but I didn't find anything
> helpful. Thanks in advance for your tips and advices!

It's expected and documented behavior: http://nginx.org/r/proxy_set_header

: These directives are inherited from the previous level if and only if
: there are no proxy_set_header directives defined on the current level.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

geoip_country_code header is deleted when I set another custom header

MarcPapers January 10, 2014 04:39AM

Re: geoip_country_code header is deleted when I set another custom header

Ruslan Ermilov January 10, 2014 05:40AM

Re: geoip_country_code header is deleted when I set another custom header

MarcPapers January 10, 2014 05:57AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 268
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready