What the Error Means
Chrome uses specific codes for most network problems: a refused connection, a timeout, a DNS failure. ERR_FAILED is what remains when a request failed for a reason that has no code of its own. It can appear as an error page, or only in the developer console as net::ERR_FAILED next to the request that failed.
What a Visitor Can Try
- Reload the page.
- Open it in a private window, where extensions are usually off.
- If that works, switch extensions off one at a time to find the one that blocks it; see ERR_BLOCKED_BY_CLIENT.
- Clear the cookies and cached data for this one site.
- Pause security software or a VPN that filters web traffic.
- Try another browser and another network.
- Update the browser.
Tell a Server Problem from a Browser Problem
Ask the server directly, without the browser:
curl -sS -o /dev/null -w '%{http_code}\n' https://example.com/
curl -I https://example.com/
If curl gets a normal status code from several networks, the server answers and the problem sits in the browser: an extension, site data, a service worker, or a policy such as CORS. If curl fails too, follow the server-side guides, starting with this site can't be reached.
Developers: CORS
When JavaScript on one origin calls an API on another, the browser checks the response headers. If the check fails, the console shows a message that the request "has been blocked by CORS policy", and the request ends with net::ERR_FAILED. The server did answer; the browser refused to hand the answer to the page.
- Allowed origin: the response needs an
Access-Control-Allow-Originheader with the calling origin. - Preflight: for JSON bodies, custom headers, or methods such as PUT, the browser first sends an OPTIONS request. It must succeed and list the allowed methods and headers.
- Credentials: with cookies, the allowed origin must be named exactly; a wildcard is not accepted.
- One place only: if both the application and the proxy add the header, the browser sees two values and rejects them.
Test the preflight with curl:
curl -i -X OPTIONS https://api.example.com/orders \
-H "Origin: https://app.example.com" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: content-type"
A 405 here means the server does not accept OPTIONS for that path; see 405 Method Not Allowed.
Developers: Service Workers
A service worker sits between the page and the network. If its fetch handler answers with a promise that rejects, or with a network error such as Response.error(), the request can fail as ERR_FAILED even though the server is fine. In the developer tools, the Application panel lists service workers; unregister the worker or bypass it for the network and reload. After a deploy, a new worker version that handles errors cleanly fixes the problem for every visitor.
Check the Server Logs
Find out whether the failing request reached the server at all:
sudo tail -f /var/log/nginx/access.log
No line means the browser never sent it, or something on the way stopped it. A line with an error status points to the application. Log locations are in Nginx logs and Apache logs.
Summary
- Works in a private window: an extension or site data.
- Works with curl, fails in the page: CORS or a service worker.
- Fails with curl too: the server or the network.