什么是网络::: ERR_HTTP2_PROTOCOL_ERROR? [英] What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

查看:6760
本文介绍了什么是网络::: ERR_HTTP2_PROTOCOL_ERROR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在网站上,该网站在Google Chrome浏览器上触发net::ERR_HTTP2_PROTOCOL_ERROR 200错误.我不确定究竟是什么会引起此错误,我只是注意到它仅在使用HTTPS访问网站时弹出.我不能100%确定它的相关性,但是看起来它阻止了javascript的正确执行.

I'm currently working on a website, which triggers a net::ERR_HTTP2_PROTOCOL_ERROR 200 error on Google Chrome. I'm not sure exactly what can provoke this error, I just noticed it pops out only when accessing the website in HTTPS. I can't be 100% sure it is related, but it looks like it prevents javascript to be executed properly.

例如,发生以下情况:

  1. 我正在使用HTTPS访问网站

  1. I'm accessing the website in HTTPS

我的通过 https://publish.twitter.com 集成的Twitter提要未加载到全部

My Twitter feed integrated via https://publish.twitter.com isn't loaded at all

我可以在控制台中注意到ERR_HTTP2_PROTOCOL_ERROR

I can notice in the console the ERR_HTTP2_PROTOCOL_ERROR

如果我删除了加载Twitter feed的代码,则错误仍然存​​在

If I remove the code to load the Twitter feed, the error remains

如果我通过HTTP访问网站,则会显示Twitter feed,并且错误消失

If I access the website in HTTP, the Twitter feed appears and the error disappears

Google Chrome是唯一触发该错误的Web浏览器:它在Edge和Firefox上均能很好地工作. (注意:我尝试使用Safari,并且遇到类似的kcferrordomaincfnetwork 303错误)

Google Chrome is the only web browser triggering the error: it works well on both Edge and Firefox. (NB: I tried with Safari, and I have a similar kcferrordomaincfnetwork 303 error)

我想知道它是否可能与服务器返回的标头有关,因为错误中提到了"200",并且404/500页没有触发任何内容.

I was wondering if it could be related to the header returned by the server since there is this '200' mention in the error, and a 404 / 500 page isn't triggering anything.

根本没有记录错误. Google搜索给我的结果很少.此外,我注意到它出现在最近的Google Chrome浏览器版本中.该错误不会在v.64.X上弹出,但会在v.75 +上弹出(无论操作系统如何;我在Mac tho上工作).

Thing is the error isn't documented at all. Google search gives me very few results. Moreover, I noticed it appears on very recent Google Chrome releases; the error doesn't pop on v.64.X, but it does on v.75+ (regardless of the OS; I'm working on Mac tho).

在此进行调查的任何线索将不胜感激!

Any clue at this point to investigate would be gladly appreciated !

谢谢.

特里斯坦

可能与 进一步调查的结果如下:

Edit 2 : Findings from further investigations are the following :

    如果服务器返回404而不是2XX,则
  • 错误不会在完全相同的页面上弹出
  • 使用HTTPS证书的本地错误不会弹出
  • 错误在使用不同证书的另一台服务器(都是OVH)上弹出
  • 无论使用什么版本的PHP,从5.6到7.3(使用的框架:Cakephp 2.10),都会弹出
  • 错误消息.
  • error doesn't pop on the exact same page if server returns 404 instead of 2XX
  • error doesn't pop on local with a HTTPS certificate
  • error pops on a different server (both are OVH's), which uses a different certificate
  • error pops no matter what PHP version is used, from 5.6 to 7.3 (framework used : Cakephp 2.10)

根据要求,下面是失败的资源(即整个网页)的返回标头.即使错误是在具有HTTP标头200的每个页面上触发的,这些页面也始终在客户端的浏览器中加载,但是有时会丢失一个元素(例如,外部Twitter feed).除了整个文档本身,网络"选项卡上的所有其他资产都有成功的返回值.

Edit 3 : As requested, below is the returned header for the failing ressource, which is the whole web page. Even if the error is triggering on each page having a HTTP header 200, those pages are always loading on client's browser, but sometimes an element is missing (in my exemple, the external Twitter feed). Every other asset on the Network tab has a success return, except the whole document itself.

Google Chrome浏览器标头(错误):

Google Chrome header (with error) :

Firefox标头(无错误):

Firefox header (without error) :

控制台中的curl --head --http2请求返回以下成功:

A curl --head --http2 request in console returns the following success :

HTTP/2 200 
date: Fri, 04 Oct 2019 08:04:51 GMT
content-type: text/html; charset=UTF-8
content-length: 127089
set-cookie: SERVERID31396=2341116; path=/; max-age=900
server: Apache
x-powered-by: PHP/7.2
set-cookie: xxxxx=0919c5563fc87d601ab99e2f85d4217d; expires=Fri, 04-Oct-2019 12:04:51 GMT; Max-Age=14400; path=/; secure; HttpOnly
vary: Accept-Encoding


尝试深入了解chrome://net-export/和 https://netlog-viewer.appspot.com 工具告诉我请求以RST_STREAM结尾:


Edit 4 : Trying to go deeper with the chrome://net-export/ and https://netlog-viewer.appspot.com tools is telling me the request ends with a RST_STREAM :

t=123354 [st=5170]    HTTP2_SESSION_RECV_RST_STREAM
                      --> error_code = "2 (INTERNAL_ERROR)"
                      --> stream_id = 1

关于我在其他文章中读到的内容,"在HTTP中/2,如果客户端要中止请求,则发送RST_STREAM;当服务器收到RST_STREAM时,它将停止向客户端发送DATA帧,从而停止响应(或下载).其他请求以及与已中止的请求同时发生的请求/响应可能会继续进行. [...] 到RST_STREAM从客户端行进到服务器时,请求的全部内容可能正在传输中,并且将到达客户端,客户端将丢弃该请求.但是,对于较大的响应内容,发送RST_STREAM可能有很大的机会在发送整个响应内容之前到达服务器,因此可以节省带宽."

For what I read in this other post, "In HTTP/2, if the client wants to abort the request, it sends a RST_STREAM. When the server receives a RST_STREAM, it will stop sending DATA frames to the client, thereby stopping the response (or the download). The connection is still usable for other requests, and requests/responses that were concurrent with the one that has been aborted may continue to progress. [...] It is possible that by the time the RST_STREAM travels from the client to the server, the whole content of the request is in transit and will arrive to the client, which will discard it. However, for large response contents, sending a RST_STREAM may have a good chance to arrive to the server before the whole response content is sent, and therefore will save bandwidth."

所描述的行为与我可以观察到的行为相同.但这将意味着浏览器是罪魁祸首,然后我不明白为什么它会在两个相同的页面上发生,其中一个页面的标题为200,另一个页面的页面为404(如果禁用JS,情况也是如此).

The described behavior is the same as the one I can observe. But that would mean the browser is the culprit, and then I wouldn't understand why it happens on two identical pages with one having a 200 header and the other a 404 (same goes if I disable JS).

推荐答案

我没有弄清楚到底发生了什么,但是找到了解决方案.

I didn't figure out what exactly was happening, but I found a solution.

罪魁祸首是OVH的 CDN功能.我已经将其安装在主机服务上,但是由于不需要它而在我的域中被禁用.

The CDN feature of OVH was the culprit. I had it installed on my host service but disabled for my domain because I didn't need it.

以某种方式,当我启用它时,一切正常.

Somehow, when I enable it, everything works.

我认为这迫使Apache使用HTTP2协议,但是我不明白的是,每个标头中确实提到了HTTP2,我认为这意味着服务器正在使用正确的协议进行应答.

I think it forces Apache to use the HTTP2 protocol, but what I don't understand is that there indeed was an HTTP2 mention in each of my headers, which I presume means the server was answering using the right protocol.

因此,针对我的特殊情况的解决方案是在所有相关域上启用CDN选项.

So the solution for my very particular case was to enable the CDN option on all concerned domains.

如果有人能更好地理解此处可能发生的情况,请随时分享解释.

If anyone understands better what could have happened here, feel free to share explanations.

这篇关于什么是网络::: ERR_HTTP2_PROTOCOL_ERROR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆