[alibaba/tengine]在一个Server上开启Http/2.0后,其他ssl的Server也会自动开启Http/2.0协议

2024-07-10 784 views
0

在一个Server上开启Http/2.0后,其他ssl的Server也会自动开启Http/2.0协议 协议握手时是否有判断Host对应的Server是否开启了Http2.0协议?

回答

0

在一个Server上开启Http/2.0后,其他ssl的Server也会自动开启Http/2.0协议

这个行为正常的。只要给默认listen 开启了http2, 则下所有server {}都会开启http2。因为在选择协议前,http2数据还无法解析所以无法感知到域名。(除非使用sni中域名信息)

协议握手时是否有判断Host对应的Server是否开启了Http2.0协议?

3

这里还涉及到一个复杂问题,理论上http2连接内可以跑多个域名请求的,【假设存在你说的需求】如果连接中间某个域名的请求不需要开启HTTP2,此时也已经无法做到了。这个连接已经是http2协议了,就无法降级。

5

nginx 1.9.7的版本是不是修复了这个问题,下面是1.9.7的changelog
*) Bugfix: if nginx was built with the ngx_http_v2_module it was possible to use the HTTP/2 protocol even if the "http2" parameter of the "listen" directive was not specified.

0

hi @leeweir , 你说的这个改动意思是:不在listen <ip_port> http2;指令中加http2,也可以开启http2功能。和这里issue描述的问题不是同一个问题:issue描述的问题是 “是否能够指定特定域名开启http2"

3

@chobits 你的回答印证了我的猜测,没有使用sni中信息,所以会出现一开全开现象。 整理了一份nginx从1.9.5后的bugfix,想咨询下tengine针对这些bugfix是否有merge。 Changes with nginx 1.9.5 22-Sep-15 "
) Feature: the ngx_http_v2_module (replaces ngx_http_spdy_module). Thanks to Dropbox and Automattic for sponsoring this work." Changes with nginx 1.9.6 27-Oct-15 "
) Bugfix: a segmentation fault might occur in a worker process when using HTTP/2. Thanks to Piotr Sikora and Denis Andzakovic. ) Bugfix: the $server_protocol variable was empty when using HTTP/2." Changes with nginx 1.9.7 17-Nov-15 "
) Bugfix: a segmentation fault might occur in a worker process when using HTTP/2; the bug had appeared in 1.9.6. ) Bugfix: if nginx was built with the ngx_http_v2_module it was possible to use the HTTP/2 protocol even if the ""http2"" parameter of the ""listen"" directive was not specified." Changes with nginx 1.9.11 9-Feb-16 "
) Bugfix: the $request_length variable did not include size of request headers when using HTTP/2. ) Bugfix: in the ngx_http_v2_module." Changes with nginx 1.9.12 24-Feb-16 "
) Feature: Huffman encoding of response headers in HTTP/2. Thanks to Vlad Krasnov. ) Bugfix: socket leak when using HTTP/2. ) Bugfix: in the ngx_http_v2_module." Changes with nginx 1.9.14 5-Apr-16 "
) Feature: the ""proxy_request_buffering"", ""fastcgi_request_buffering"", ""scgi_request_buffering"", and ""uwsgi_request_buffering"" directives now work with HTTP/2. ) Bugfix: ""zero size buf in output"" alerts might appear in logs when using HTTP/2. ) Bugfix: the ""client_max_body_size"" directive might work incorrectly when using HTTP/2." Changes with nginx 1.9.15 19-Apr-16 "
) Bugfix: when using HTTP/2 and the ""limit_req"" or ""auth_request"" directives a timeout or a ""client violated flow control"" error might occur while reading client request body; the bug had appeared in 1.9.14. ) Workaround: a response might not be shown by some browsers if HTTP/2 was used and client request body was not fully read; the bug had appeared in 1.9.14." Changes with nginx 1.11.0 24-May-16 "
) Change: the ""421 Misdirected Request"" response now used when rejecting requests to a virtual server different from one negotiated during an SSL handshake; this improves interoperability with some HTTP/2 clients when using client certificates. ) Change: HTTP/2 clients can now start sending request body immediately; the ""http2_body_preread_size"" directive controls size of the buffer used before nginx will start reading client request body." Changes with nginx 1.11.2 5-Jul-16 "
) Bugfix: a segmentation fault might occur in a worker process when using HTTP/2 and the ""proxy_request_buffering"" directive. ) Bugfix: the ""Content-Length"" request header line was always added to requests passed to backends, including requests without body, when using HTTP/2. ) Bugfix: ""http request count is zero"" alerts might appear in logs when using HTTP/2." Changes with nginx 1.11.3 26-Jul-16
) Bugfix: socket leak when using HTTP/2. Changes with nginx 1.11.6 15-Nov-16 "
) Bugfix: graceful shutdown of old worker processes might require infinite time when using HTTP/2."

8

1.9.8之前都merge过了。后面会继续merge http2的功能。因为这个功能是比较重要功能且相对独立,所以会优先merge。

6

@chobits 是最新版2.2.0和2.1.2都merge了1.9.8吗(我们现在使用的是2.1.2)?我看到你们已经有Merge 1.11.6的PR了。请问下大概什么时候能完成merge?谢谢。

6
832