Azarov Alexander
April 29, 2013 06:54AM
Добрый день,

Конфиг у меня выглядит вот так:

upstream playapp {
server …:9000;
keepalive 16;
}

server {
listen ... ssl;
server_name …;

proxy_set_header Host $server_name;

location / {
limit_conn byConn 14;
limit_req zone=byReq burst=50;

proxy_pass http://playapp;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}

Проблема:

2013/04/29 14:19:02 [debug] 21900#0: *1013606439 http proxy header:
"GET /pic/2034583 HTTP/1.1
Host: playapp
Cache-Control: max-age=0
Pragma: no-cache
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31

Т.е. на бэкенд уходит "Host: playapp" вместо "Host: $server_name". Если убрать proxy_http_version и proxy_set_header Connection, все нормализуется, бэкенд видит "Host: $server_name"

# nginx -V
nginx version: nginx/1.2.6
TLS SNI support enabled
configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/cache/nginx/body --http-fastcgi-temp-path=/var/cache/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/cache/nginx/proxy --http-scgi-temp-path=/var/cache/nginx/scgi --http-uwsgi-temp-path=/var/cache/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --add-module=/usr/src/nginx-1.2.6/debian/modules/nginx-echo --add-module=/usr/src/nginx-1.2.6/debian/modules/nginx-upstream-fair --add-module=/usr/src/nginx-1.2.6/debian/modules/nginx-cache-purge

С уважением,
Александр
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

upstream keepalive + Host override : problem?

Azarov Alexander April 29, 2013 06:54AM

Re: upstream keepalive + Host override : problem?

Maxim Dounin April 29, 2013 07:02AM

Re: upstream keepalive + Host override : problem?

Azarov Alexander April 29, 2013 07:06AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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