Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 XmlHttpRequest requests fail with net::ERR_FAILED. By putting breakpoints in the server code, I can verify that the requests are never actually coming in.

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-control header. 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

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_FAILED is 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?

like image 723
Mason Wheeler Avatar asked Mar 26 '14 15:03

Mason Wheeler


1 Answers

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

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

You have to paste the fetch command into the dev console of the same origin and NOT accidentally e.g. open it from stackoverflow.

like image 188
rofrol Avatar answered Sep 20 '22 06:09

rofrol