google-chrome - 谷歌浏览器为 Ajax 调用返回 ERR_HTTP2_SERVER_REFUSED_STREAM

标签 google-chrome http http-headers http2

我在使用 Google Chrome 85 时遇到了一个在早期版本中似乎没有的问题。

我正在触发上传文件的 ajax 调用,以便在网络服务器上对其进行处理。 此调用是一个非常基本的多部分 xhr POST 请求,用于上传文件。

出于某种原因,Google Chrome(和 Firefox)拒绝接受网络服务器的响应。 Chrome Devtools 在 XHR 请求的状态列中显示“(failed)net::ERR_HTTP2_SERVER_REFUSED_STREAM”。但是我不知道为什么浏览器似乎拒绝流...

我能够使用 curl 调试返回和获取 HTTP header ,但我不知道返回 HTTP header 有什么问题,也不知道为什么 Google Chrome(和其他浏览器)似乎拒绝结果。

关于如何调试这些 HTTP header 的“有效性”的任何想法/或建议?或者他们被拒绝的原因?

请求 header (从 chrome devtools 复制粘贴):

:authority: www.redactedwebsite.com
:method: POST
:path: /cms/multi-tab-taggable-attachment/fa0acf6/add
:scheme: https
accept: application/json
accept-encoding: gzip, deflate, br
accept-language: nl,en-US;q=0.9,en;q=0.8,zh;q=0.7,zh-TW;q=0.6,zh-CN;q=0.5,de;q=0.4,ja;q=0.3
cache-control: no-cache
content-length: 5431100
content-type: multipart/form-data; boundary=----WebKitFormBoundarytN9UfBZY5RJtGVt0
cookie: PHPSESSID=9a7d2c08b9506a02c18f864fb09262a4
origin: https://www.redactedwebsite.com
referer: https://www.redactedwebsite.com/cms/page/27/edit
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
x-requested-with: XMLHttpRequest

curl 中显示的返回 header 和正文如下:

HTTP/2 200
date: Thu, 03 Sep 2020 19:21:37 GMT
server: Apache
x-powered-by: PHP/7.2.33
x-generation-time: 0,02101s
set-cookie: PHPSESSID=9a7d2c08b9506a02c18f864fb09262a4; path=/
vary: Accept-Encoding
content-encoding: gzip
content-length: 272
content-type: application/json
x-varnish: 565546302
age: 0
via: 1.1 varnish (Varnish/6.4)
accept-ranges: bytes

{"success":true, <and much more, redacted>}

我没有发现返回或请求 header 有任何问题,而且我不知道为什么 XHR 调用被 Chrome 阻止并给出:“(failed)net::ERR_HTTP2_SERVER_REFUSED_STREAM”。

有什么想法吗?或者我可以在哪里调试或验证我的请求/返回 header 的建议? 非常感谢!

干杯, B.

最佳答案

对于来自谷歌的人来说,有更多原因的答案here .

就我而言,我使用的是办公室 VPN。似乎 VPN 正在将 HTTP2 请求降级为 HTTP/1.1,因此服务器通过 ERR_HTTP2_SERVER_REFUSED_STREAM 拒绝了它们。

关于google-chrome - 谷歌浏览器为 Ajax 调用返回 ERR_HTTP2_SERVER_REFUSED_STREAM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63730523/

相关文章:

apache-flex - 如何在 Chrome 中禁用 Flash Player 自动更新?

css - 谷歌浏览器 CSS 位置不正确

javascript - 在应用程序模式下运行的 Chrome 浏览器中使用 <BODY onUnload> 标签

javascript - 服务器响应结束时执行代码 - Node.js

python-3.x - 如何在 FastAPI 中转储 http "Content-type: application/json;"

javascript - 删除 jQuery.ajaxSetup 中设置的特定请求 header

python - python 可以访问谷歌浏览器 webSQL 数据库

mysql - $http.get 和方法 :'GET' 的区别

angularjs - 未调用 $http.get 成功方法

c# - 如何使用 HttpClient 根据个人请求设置 HttpHeader