为什么在 nginx/nginx 上游使用 http/1.0?

mon*_*key 2 nginx keep-alive http-1.0 http-1.1

我有 3 个服务器:A(nginx)-->B(nginx)-->C(nodejs),

当我访问 A 或 B 时,chrome 默认使用 http/1.1+keepalive。

我没有设置“proxy_http_version 1.1;” 和 proxy_set_header 连接 "";

但是在 A 和 B 之间,NGINX 默认使用 http/1.0? 那就像:

客户端--> nginxA(上游到 b) --> nginxB(上游到 c) --> C (nodejs)

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

我的问题是:为什么 nginx 默认使用 http/1.1 作为上游?在 nginx 和 nginx 之间,上游使用 http/1.0 ?

谢谢。

Tym*_*ski 5

Nginx 从 1.1.4 版开始在连接上游服务器时支持 HTTP/1.1。您只需要设置配置参数proxy_http_version 1.1(1.0 是默认值)。见http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version

  • 那么问题是为什么他们的代理 http 版本默认为 1.0 而不是 1.1 (2认同)