Welcome! Log In Create A New Profile

Advanced

http upstream keepalives

May 14, 2012 01:34PM
Hi, I'm reading here:
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive

so I've tried:

server {
keepalive_timeout 70;
error_log /var/log/nginx/test-error.log;

listen 80;
server_name www.dave.it;
proxy_read_timeout 3600;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://172.16.7.9:2323;
}
}

On 172.16.7.9 I launched:

> nc -4 -l 172.16.7.9 2323

And so I saw:
GET / HTTP/1.1
Host: 172.16.7.9:2323
User-Agent: Wget/1.12 (darwin10.5.0)
Accept: */*


As you can see the Host header is wrong so I tested this vhost:
server {
keepalive_timeout 70;
error_log /var/log/nginx/test-error.log;

listen 80;
server_name www.dave.it;
proxy_read_timeout 3600;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";

location / {
proxy_pass http://172.16.7.9:2323;
}
}

And this time the backend answered as expected:

GET / HTTP/1.1
Host: www.dave.it
X-Real-IP: 172.16.7.249
X-Forwarded-For: 172.16.7.249
User-Agent: Wget/1.12 (darwin10.5.0)
Accept: */*


So I think that a little modification to documentation could be a good
idea :)

Thanks,
d.


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

http upstream keepalives

davide.damico May 14, 2012 01:34PM

Re: http upstream keepalives

Valentin V. Bartenev May 14, 2012 02:28PM

Re: http upstream keepalives

Francis Daly May 14, 2012 02:58PM

Re: Re: http upstream keepalives

davide.damico May 15, 2012 12:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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