Html 什么会导致 Chrome 在针对本地主机上的服务器的缓存内容上给出 net::ERR_FAILED?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22665232/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 01:23:38  来源:igfitidea点击:

What can cause Chrome to give an net::ERR_FAILED on cached content against a server on localhost?

htmlgoogle-chromecachinghttp.sys

提问by Mason Wheeler

I'm building a web server and trying to test things. The server is running on localhost:888, and the first time I load the web app, everything works. But if I try to reload the page, a bunch of XmlHttpRequestrequests fail with net::ERR_FAILED. By putting breakpoints in the server code, I can verify that the requests are never actually coming in.

我正在构建一个 Web 服务器并尝试进行测试。服务器正在运行localhost:888,我第一次加载 Web 应用程序时,一切正常。但是如果我尝试重新加载页面,一堆XmlHttpRequest请求会失败并显示net::ERR_FAILED. 通过在服务器代码中放置断点,我可以验证请求从未真正进入。

This isn't a connection failure, as the connection succeeds the first time. The fact that it succeeds once and then fails later implies that it might be caching-related, but there's nothing in the server code that sets the cache-controlheader. So I tested it by putting the server up on an actual web server. The first time, everything had to take its time loading; the second time, it all loaded instantly, so this is definitely cache-related

这不是连接失败,因为连接是第一次成功。它成功一次然后失败的事实意味着它可能与缓存相关,但服务器代码中没有设置cache-control标头的任何内容。所以我通过将服务器放在实际的 Web 服务器上来测试它。第一次,一切都必须花时间加载;第二次,它立即加载,所以这绝对是缓存相关的

This is a custom server running on top of http.sys(no IIS), and it appears that things are getting cached by default and then failing to load from it on subsequent runs, but only when my server is running on localhost; on the Web, it works fine. As near as I can tell, net::ERR_FAILEDis a generic "something went wrong and we've got no useful information for you" message in Chrome, so I'm kind of stuck here. Does anyone know what could be causing this?

这是一个运行在http.sys(无 IIS)之上的自定义服务器,似乎默认情况下会缓存内容,然后在后续运行中无法从中加载,但仅当我的服务器在 localhost 上运行时;在网络上,它工作正常。据我所知,net::ERR_FAILEDChrome 中是一条通用的“出现问题,我们没有为您提供有用的信息”消息,所以我有点卡在这里。有谁知道是什么原因造成的?

回答by rofrol

I run into similar problem. I have copied request as fetch in Network tab in devtools..

我遇到了类似的问题。我已在 devtools 的 Network 选项卡中将请求复制为 fetch ..

Then I have run it in browser dev console. There I could read description of the error about CORS. After sertting cors on the api server, it worked.

然后我在浏览器开发控制台中运行它。在那里我可以阅读有关 CORS 的错误描述。在 api 服务器上插入 cors 后,它起作用了。

回答by materliu

The most possible reason is that you write your AppCache Manifest wrong. For example: in you /a/b/cache.html file you refer the cache.appcache Manifest file, but in cache.appcache file you announce like:

最可能的原因是您写错了 AppCache Manifest。例如:在你的 /a/b/cache.html 文件中你引用了 cache.appcache Manifest 文件,但在 cache.appcache 文件中你声明如下:

CACHE:

缓存:

/cache.html

/cache.html

which is wrong.

这是错误的。

you should write:

你应该写:

CACHE:

缓存:

/a/b/cache.html

/a/b/cache.html

hope this can help you.

希望这可以帮到你。

回答by Wilt

I ran into this error on my localhost (on a monday morning) when requesting one of my virtual hosts. Turned out I still had a unfinished debugging action running (unfinished business from my friday afternoon :) ) on another virtual host which blocked Apache from serving the files for the other request. This resulted in the net::ERR_FAILEDerror in my browser console.

在请求我的一个虚拟主机时,我在我的本地主机上(在星期一早上)遇到了这个错误。结果我仍然在另一个虚拟主机上运行了一个未完成的调试操作(从我星期五下午开始的未完成的事情:)),它阻止了 Apache 为另一个请求提供文件。这导致net::ERR_FAILED我的浏览器控制台出现错误。

Hope this might be helpful for others ending up here.

希望这可能对其其他人有所帮助。

回答by RyanShao

I met a similar problem.

我遇到了类似的问题。

my server is lived in K8S. when client use the ingress route to serve problem API, if there are tons of requests. client will receive the same net::ERR_FAILED error. it has no issue when use external load balance.

我的服务器住在 K8S 中。当客户端使用入口路由来服务有问题的 API 时,如果有大量的请求。客户端将收到相同的 net::ERR_FAILED 错误。使用外部负载平衡时没有问题。

Then i use JMeter to test the ingress route throughtput, it proved to be solid. i am testing using disable cache mode.

然后我使用 JMeter 来测试入口路由吞吐量,它被证明是可靠的。我正在使用禁用缓存模式进行测试。