Welcome! Log In Create A New Profile

Advanced

Re: Цепочка nginx proxy

Gena Makhomed
March 23, 2015 06:08PM
On 23.03.2015 23:50, MereMortals wrote:

> Есть такая схема
>
> клиент <->nginx_1 <->nginx_2<->apache
>
> На nginx_1 настрен GeoIP и в настройках прописано:
>
> proxy_set_header Host $host;
> proxy_set_header X-Forwarded-For $remote_addr;
> proxy_set_header X-Real-IP $my_real_ip;
> proxy_set_header GEOIP_COUNTRY_CODE $geoip_country_code;
> proxy_set_header GEOIP_COUNTRY_CODE3 $geoip_country_code3;
> proxy_set_header GEOIP_COUNTRY_NAME $geoip_country_name;
> proxy_set_header GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
> proxy_set_header GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
> proxy_set_header GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
> proxy_set_header GEOIP_CITY_COUNTRY_NAME2 $geoip_city_country_name;
> proxy_set_header GEOIP_REGION $geoip_region;
> proxy_set_header GEOIP_CITY $geoip_city;
> proxy_set_header GEOIP_POSTAL_CODE $geoip_postal_code;
> proxy_set_header GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
> proxy_set_header GEOIP_LATITUDE $geoip_latitude;
> proxy_set_header GEOIP_LONGITUDE $geoip_longitude;
>
> Но почему то до apache не доходят заголовки GEOIP_*, но доходят
> X-Forwarded-For и X-Real-IP. На вход у nginx_2 заголовки приходят, проверено
> через tcpdump, но почему то он их не проксирует. В чем может быть причина?

Потому что:
http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers
http://nginx.org/en/docs/http/ngx_http_core_module.html#ignore_invalid_headers

Если вместо proxy_set_header GEOIP_REGION $geoip_region;
написать proxy_set_header GeoIP-Region $geoip_region;
то такой заголовок тоже пройдет нормально.

--
Best regards,
Gena

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

Цепочка nginx proxy

MereMortals March 23, 2015 05:50PM

Re: Цепочка nginx proxy

Gena Makhomed March 23, 2015 06:08PM

Re: Цепочка nginx proxy

Maxim Dounin March 23, 2015 06:28PM

Re: Цепочка nginx proxy

Pavel Mihaduk March 24, 2015 04:36AM

Re: Цепочка nginx proxy

Maxim Dounin March 24, 2015 08:14AM

Re: Цепочка nginx proxy

Pavel Mihaduk March 24, 2015 08:38AM

Re: Цепочка nginx proxy

Maxim Dounin March 24, 2015 10:28AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 122
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