9

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.

3
  • Are you sure you didn't configure nginx to use http/1.1 for node? Commented Dec 21, 2016 at 18:19
  • Yes,I'm sure.I use Tengine-2.2.0(based Nginx-1.8.1).Thank you for your quick reply. Commented Dec 22, 2016 at 2:26
  • I think i find my result:serverfault.com/questions/442960/… thanks~ Commented Jan 11, 2017 at 2:52

1 Answer 1

12

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

Sign up to request clarification or add additional context in comments.

2 Comments

then a question is why they have the proxy http verison default to 1.0 and not 1.1
Because 1.1 has keepalive and you should add keepalive directive to your upstream to get it working I guess,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.