为什么Chrome浏览器无法识别我的http2服务器?

时间:2016-12-13 07:56:57

标签: google-chrome nginx http2

我根据Digital Ocean paper设置了我的Nginx配置, 现在http2可用......

但在Chrome(版本54.0.2840.98(64位))开发工具中,它总是在HTTP 1/1上:

NAME             METHOD  STATUS  PROTOCOL
shell.js?v=xx..    GET    200     http/1/1

我的服务器正在运行Ubuntu 16.04 LTS,它同时支持ALPN和NPN和随附的openssl版本是1.0.2g

我使用this tool site检查了http2支持,结果是:

Yeah! example.com supports HTTP/2.0. ALPN supported...

同时用curl检查就可以了

 $ curl -I --http2 https://www.example.com
  HTTP/2 200 
  server: nginx/1.10.0 (Ubuntu)
  date: Tue, 13 Dec 2016 15:59:13 GMT
  content-type: text/html; charset=utf-8
  content-length: 5603
  x-powered-by: Express
  cache-control: public, max-age=0
  etag: W/"15e3-EUyjnNnyevoQO+tRlVVZxg"
  vary: Accept-Encoding
  strict-transport-security: max-age=63072000; includeSubdomains
  x-frame-options: DENY
  x-content-type-options: nosniff

我还从我的控制台检查了is-http2 cli

is-http2 www.amazon.com
× HTTP/2 not supported by www.amazon.com
Supported protocols: http/1.1

is-http2 www.example.com
✓ HTTP/2  supported by www.example.com
Supported protocols: h2 http/1.1

为什么Chrome会落后于它? 如何使用Safari(v 10.0.1)

进行检查

3 个答案:

答案 0 :(得分:16)

可能是以下两个原因之一:

  1. 您正在使用防病毒软件并且MITM是您的流量,因此将您降级为HTTP / 1.1。关闭AV上的https流量监控以直接连接到服务器。您可以使用an online tool to test your site for HTTP/2 support

  2. 检查是否属于这种情况
  3. 您正在使用较旧的TLS密码,特别是Chrome不允许使用HTTP / 2(https://http2.github.io/http2-spec/#BadCipherSuites)的密码,如上述指南第5步所述。使用https://www.ssllabs.com/ssltest/扫描您的网站,检查您的TLS配置并进行改进。

  4. 第三个原因是lack of ALPN support in your SSL/TLS library(即你正在使用openssl 1.0.1,例如需要一个1.0.2或更高版本),但你已经确认你有ALPN支持,所以跳过这个答案

答案 1 :(得分:0)

我有同样的问题。我的情况是因为我在NGINX中启用了TLS1.3。参见Why is my site not using http/2 while it is http/2 enabled

答案 2 :(得分:-1)

就我而言,chrome 在 chrome-net-export-log.json 文件中生成了以下摘录。

HTTP2_SESSION_RECV_INVALID_HEADER
--> error = "标题名称中的无效字符。"
--> header_name = "x-xss-protection:"
--> header_value = "1; mode=block"


从标题名称中删除 : 后,问题解决了。