页面加载时出现不一致的 ERR_HTTP2_SERVER_REFUSED_STREAM 错误 [英] Inconsistent ERR_HTTP2_SERVER_REFUSED_STREAM error on page-load

查看:179
本文介绍了页面加载时出现不一致的 ERR_HTTP2_SERVER_REFUSED_STREAM 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我至少有两个 wordpress 站点,它们非常不一致地抛出了不同数量的 net::ERR_HTTP2_SERVER_REFUSED_STREAM 错误.当这些错误发生时,抛出的错误数量从页面加载到页面加载(或重新加载)从说 4 个带有该错误的请求到大约 60 个,有时甚至更多(如果页面有很多请求).实际受影响的资源/请求似乎完全随机,因此不会留下任何线索.

I do have at least two wordpress sites which very inconsistently throw a varying number of net::ERR_HTTP2_SERVER_REFUSED_STREAM errors. When these errors occur the number of errors thrown highly varies from page-load to page-load (or reload) from say 4 requests with that error to about 60 and sometimes even more (if the page has some many requests). The actually affected ressources/requests seem completly random and therefore don't leave any clue where this is coming from.

如果发生这些错误,它们的发生通常会持续(在执行简单的页面刷新或硬刷新时),直到浏览器重新启动.他们甚至很少在重启后留下来.

If these errors occur their occurrence mostly persists (when doing a simple page refresh or hard refresh) until the browser is restarted. Seldomly they even stay after a restart as well.

当这个 hiccup 确实发生并且浏览器/系统进入这种错误状态时,这些错误也会发生在 wordpress 后端加载诸如 .../wp-includes/js 之类的基本文件中/wp-lists.min.js?ver=5.7 和类似的.

When this hiccup does happen and the browser/system gets in this faulty state, these errors also happen in the wordpress backend loading basic files like .../wp-includes/js/wp-lists.min.js?ver=5.7 and similar.

至少有两名用户在 Chrome、Opera 和 Edge 中登录和退出 wordpress 时遇到过这种行为.在 Opera 和 Edge 中,我们没有安装任何浏览器扩展.据我们所知,其他用户从未遇到过此问题,即使他们中的一些人多次访问该网站.

At least two users have experienced this behaviour in Chrome, Opera and Edge while being logged-in to and -out of wordpress. In Opera and Edge we do not have any browser extensions installed. As far as we know other users never had this issue even though some of them visited the site many times.

这可能是什么原因和/或可能的解决方法是什么?

What might be the reasons for this and/or what might be a way to solve it?

安装在两个站点上的插件列表:

List of Plugins installed on both sites:

推荐答案

这与 WordPress 无关.它与使用 HTTP/2 标准的 Apache 或 Nginx 相关.

This is not related to WordPress. It's related to either Apache or Nginx using the HTTP/2 standard.

REFUSED_STREAM (0x7):端点拒绝流之前执行任何应用程序处理(请参阅第 8.1.4 节了解详情).

REFUSED_STREAM (0x7): The endpoint refused the stream prior to performing any application processing (see Section 8.1.4 for details).

它可能来自过多的并发流:

It can either come from too many concurrent streams:

端点不得超过其对等方设置的限制.接收到导致超出其通告的并发流限制的 HEADERS 帧的端点必须将此视为 PROTOCOL_ERROR 或 REFUSED_STREAM 类型的流错误(第 5.4.2 节).错误码的选择决定了端点是否希望启用自动重试(详见第 8.1.4 节).

Endpoints MUST NOT exceed the limit set by their peer. An endpoint that receives a HEADERS frame that causes its advertised concurrent stream limit to be exceeded MUST treat this as a stream error (Section 5.4.2) of type PROTOCOL_ERROR or REFUSED_STREAM. The choice of error code determines whether the endpoint wishes to enable automatic retry (see Section 8.1.4) for details).

它也可以在推送响应操作期间发送:

It can also be sent during a Push Response operation:

如果客户端出于任何原因确定它不希望接收来自服务器的推送响应,或者如果服务器开始发送承诺响应的时间过长,则客户端可以使用以下任一方式发送 RST_STREAM 帧CANCEL 或 REFUSED_STREAM 代码并引用推送流的标识符.

If the client determines, for any reason, that it does not wish to receive the pushed response from the server or if the server takes too long to begin sending the promised response, the client can send a RST_STREAM frame, using either the CANCEL or REFUSED_STREAM code and referencing the pushed stream's identifier.

或者如果客户端尝试使用 HTTP/1.1 进行连接:

Or if the client is trying to connect using HTTP/1.1:

不希望处理 HTTP/1.1 响应的服务器应该在发送连接前言后立即拒绝带有 REFUSED_STREAM 错误代码的流 1,以鼓励客户端通过升级的 HTTP/2 连接重试请求.

Servers that don’t wish to process the HTTP/1.1 response should reject stream 1 with a REFUSED_STREAM error code immediately after sending the connection preface to encourage the client to retry the request over the upgraded HTTP/2 connection.

我无法确定在这些请求期间发生了什么,因为它可能有多种原因,如上所述.

There is no way for me to pinpoint what is happening during those requests, as it can have multiple reasons, as stated above.

所以我建议你几个选择:

So I suggest you a couple of options:

  • 通过 Cloudflare 传递您网站的流量,因此它们充当这些连接的中间人,并规范发送到您服务器的请求
  • 您可以增加 SETTINGS_MAX_CONCURRENT_STREAMS 以最大程度地降低发送 REFUSED_STREAM 的风险.如果您使用 Nginx,您可以在此处查看如何执行此操作:http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_concurrent_streams
  • 如果您不知道如何执行上述操作,请联系您的托管公司并要求他们为您完成并升级您的 Nginx 版本,因为已知某些旧版本存在问题.
  • 在 Nginx 中禁用 HTTP/2.如何在 nginx 中禁用 http2
  • 作为最后的资源,您可以迁移到另一家托管公司.
  • Pass your site's traffic throughugh Cloudflare, so they act as a middle-man for these connections and normalize the requests sent to your server
  • You can increase the SETTINGS_MAX_CONCURRENT_STREAMS to minimize the risk of sending a REFUSED_STREAM. If you use Nginx, you can see how to do this here: http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_concurrent_streams
  • If you don't know how to do the above, contact your hosting company and ask them to do it for you and upgrade your Nginx version, as some older versions are known to have issues.
  • Disable HTTP/2 in Nginx. How to disable http2 in nginx
  • As a last resource, you can migrate to another hosting company.

如果你使用 Apache,我上面所说的一切也适用于它.

If you use Apache, everything I said above applies to it as well.

这篇关于页面加载时出现不一致的 ERR_HTTP2_SERVER_REFUSED_STREAM 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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