Search code examples
nginxkeep-alivehttp-1.1http-1.0

why between nginx/nginx upstream use http/1.0?


I have 3 server: A(nginx)-->B(nginx)-->C(nodejs),

When i access A or B,chrome use http/1.1+keepalive by default.

I do not set "proxy_http_version 1.1;" and proxy_set_header Connection "";

But between A and B,NGINX use http/1.0 by default。That is like:

client --> nginxA(upstream to b) --> nginxB(upstream to c) -->C (nodejs)

http/1.1 --> http/1.0 --> http/1.1 --> nodejs

My questions is : why nginx use http/1.1 for upstream by default,between nginx and nginx, upstream use http/1.0 ?

THX.


Solution

  • Nginx since version 1.1.4 supports HTTP/1.1 when connecting to upstream servers. You just need to set configuration parameter proxy_http_version 1.1 (1.0 is the default value). see http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version