Chrome在spnego需要401之后强制使用http1.1而不是h2



我配置了nginx+spnego模块,通过特定地址的sso登录用户,并注意到一旦发生这种情况,chrome就会强制整个子域使用http/1.1。没有SSO,整个站点都在使用http/2。Nginx是(1.15.0),来自github的spnego模块和当前的chrome(v71)。

我打开了nginx中的调试信息,其中有:

2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL ALPN supported by client: h2
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL ALPN supported by client: http/1.1
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL ALPN selected: h2
2019/01/07 14:39:11 [debug] 42132#42132: *2379 SSL ALPN supported by client: h2
2019/01/07 14:39:11 [debug] 42132#42132: *2379 SSL ALPN supported by client: http/1.1
2019/01/07 14:39:11 [debug] 42132#42132: *2379 SSL ALPN selected: h2
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL_do_handshake: -1
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL_get_error: 2
2019/01/07 14:39:11 [debug] 42129#42129: *2378 reusable connection: 0
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL handshake handler: 0
2019/01/07 14:39:11 [debug] 42129#42129: *2378 ssl new session: 057AF550:32:184
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL_do_handshake: 1
2019/01/07 14:39:11 [debug] 42129#42129: *2378 SSL: TLSv1.2, cipher: "ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD"
2019/01/07 14:39:11 [debug] 42129#42129: *2378 init http2 connection

在这个阶段,它是可以的-它是http2,但模块发送401代码并要求凭据:

2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 header filter
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 push resources
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: ":status: 401"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "server: nginx"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "date: Mon, 07 Jan 2019 13:41:05 GMT"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "content-type: text/html; charset=utf-8"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "content-length: 590"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "www-authenticate: Negotiate"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 output header: "strict-transport-security: max-age=63072000; includeSubDomains; preload"
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2:5 create HEADERS frame 000055B593338C60: len:133 fin:0
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http cleanup add: 000055B593338D58
2019/01/07 14:41:05 [debug] 42129#42129: *2378 http2 frame out: 000055B593338C60 sid:5 bl:1 len:133

在这一点上,h2似乎工作得很好,之后chrome只发送http1.1alpn来响应401页面:

2019/01/07 14:41:05 [debug] 42129#42129: *2378 reusable connection: 1
2019/01/07 14:41:05 [debug] 42129#42129: *2378 event timer del: 53: 8023593525
2019/01/07 14:41:05 [debug] 42129#42129: *2378 event timer add: 53: 180000:8023706453
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL ALPN supported by client: http/1.1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL ALPN selected: http/1.1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL_do_handshake: -1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL_get_error: 2
2019/01/07 14:41:05 [debug] 42129#42129: *4179 reusable connection: 0
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL handshake handler: 0
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL_do_handshake: 1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL: TLSv1.2, cipher: "ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD"
2019/01/07 14:41:05 [debug] 42129#42129: *4179 SSL reused session
2019/01/07 14:41:05 [debug] 42129#42129: *4179 reusable connection: 1
2019/01/07 14:41:05 [debug] 42129#42129: *4179 http wait request handler

之后,所有内容都将在整个域的http/1中。我在nginx中配置了通配符服务器,并对其进行了多次测试,直到authh2,以及authhttp1之后。目前,我将把auth端点移到另一个子域,这样chrome就不会强制应用程序使用http1,但我仍在寻找解决方案。我检查了ssl、cert和密码——这在http/1和http/2上没有改变,也不是任何防病毒软件。此外,我无法在登录后清除该状态和FORCE http/2,唯一有帮助的是杀死chrome进程。清除应用缓存没有帮助。

它适用于IE和EDGE。默认情况下,Firefox不支持SSO和策略。

如何强制Chrome使用http/2作为域名?如果在auth页面上无法做到这一点,我如何才能强制将其应用于除一个url之外的其他页面?任何人都知道如何在开发工具中强制chrome重新协商http/2。此外,我在chrome中找不到任何关于从http://2切换到v1 的日志和错误

这是Chrome中的一个已知错误。Chrome不支持HTTP/2上的SSO,但也不支持到同一域的一些HTTP/1和一些HTTP/2连接,这是一个连锁反应。

在此处查看错误https://bugs.chromium.org/p/chromium/issues/detail?id=832586

尤其是底部的评论:

这里问题的根源是网络堆栈当前不支持同时进行HTTP/1.1和HTTP/2连接服务器关于这方面的意见,请参见第685741期评论10和11可能

最新更新