【问题标题】:Chrome forces http1.1 instead of h2 after 401 needed for spnegoChrome 在 spnego 需要 401 之后强制使用 http1.1 而不是 h2
【发布时间】:2019-06-03 04:57:11
【问题描述】:

我将 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 仅发送 http 1.1 alpn 以响应 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 中配置了通配符服务器并测试了很多次——直到 auth h2 和 auth http1 之后。现在我将 auth 端点移动到另一个子域,因此 chrome 不会强制 http1 用于应用程序,但我仍在寻找修复。 我检查了 ssl、cert、ciphers - 在 http/1 和 http/2 上没有改变,而且它不是任何防病毒软件。 此外,登录后我无法清除该状态和 FORCE http/2,唯一有帮助的是杀死 chrome 进程。清除应用缓存没有帮助。

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

如何强制 Chrome 使用 http/2 作为域?如果无法在身份验证页面上执行此操作,我如何将其强制到除一个 url 之外的其他页面? 任何人都知道如何强制 chrome 在开发工具中重新协商 http/2。 我在 chrome 中也找不到任何关于从 http/2 切换到 v1 的日志和错误

【问题讨论】:

    标签: google-chrome nginx single-sign-on http2 spnego


    【解决方案1】:

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

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

    尤其是底部的评论:

    这里问题的根源是网络堆栈当前 不支持同时连接到相同的 HTTP/1.1 和 HTTP/2 服务器。请参阅 issue 685741 cmets 10 和 11 关于对此的看法 可能性。

    【讨论】:

    • 谢谢!我找不到 :( 我将您的回复标记为答案,但可以肯定 - 对问题无能为力。同时我将 auth 端点移动到另一个域,设置所有 cors 标头,它现在可以工作,http/1 仅限对于那个不同的域,h2 可以在其他所有东西上运行。我希望 Chrome 有一天能解决这个问题,因为它可以在其他浏览器上正常运行。
    猜你喜欢
    • 2017-01-23
    • 2018-11-04
    • 2017-03-12
    • 2016-08-15
    • 2011-03-22
    • 2014-03-05
    • 1970-01-01
    • 2018-05-10
    • 1970-01-01
    相关资源
    最近更新 更多