The request never reached the server. The client could not establish a connection.
Status code 0 is not an official HTTP status code defined by any RFC or the IANA HTTP Status Code Registry. It is a client-side indicator that the HTTP request was never completed. The browser or HTTP client reports 0 when it cannot establish a connection to the server at all.
This commonly occurs due to CORS policy violations, network connectivity issues, DNS failures, ad blockers, or the request being cancelled before completion. Because no HTTP response was ever received, the status code defaults to 0 in most HTTP client implementations including browsers (Fetch API, XMLHttpRequest), curl, and HTTP libraries in every programming language.
Unlike server errors such as 502 or 503 where the server (or a gateway) actively returns an error response, a status code of 0 means no response was received whatsoever. The TCP connection either failed to establish, was terminated prematurely, or was blocked before it could be attempted.
Status code 0 appears across many different contexts where HTTP requests are made:
status: 0 or an XHR object with status === 0 when the request is blocked or fails at the network levelAccess-Control-Allow-Origin header doesn't include the requesting origin. The browser makes a preflight OPTIONS request, and if it fails or returns restrictive headers, the actual request is never sent.AbortController.abort(), xhr.abort(), or the user navigates away from the page before the request completes.Platform-Specific Notes:
Chrome Shows (failed) net::ERR_FAILED in the Network tab. CORS blocks show a specific error in the Console: "Access to fetch at ... has been blocked by CORS policy".
Firefox Displays "NS_ERROR_DOM_BAD_URI" for CORS issues or "NS_ERROR_CONNECTION_REFUSED" when the server is down. Check the Console for details.
Safari Reports "Origin is not allowed by Access-Control-Allow-Origin" for CORS. Network errors show as "Failed to load resource" with less detail than Chrome.
Node.js Libraries like Axios throw an error with error.response === undefined and error.code set to ECONNREFUSED, ENOTFOUND, or ETIMEDOUT.
(failed) or (canceled). Click the entry to see the error details. This tells you whether it's CORS, DNS, SSL, or a network issue.Access-Control-Allow-Origin, Access-Control-Allow-Methods, and Access-Control-Allow-Headers. Test the preflight OPTIONS request separately.curl -v https://the-url.com/endpoint from your terminal. If curl succeeds but the browser fails, the issue is browser-specific (CORS, extensions, or mixed content). If curl also fails, it's a server or network problem.nslookup domain.com or dig domain.com to verify the domain resolves to a valid IP address. If DNS fails, the domain may be misconfigured or your DNS server may be unreachable.openssl s_client -connect domain.com:443 or check the certificate in your browser's security panel. Look for expiration dates, domain mismatches, and chain issues.http:// URLs in your JavaScript code and update them to https://.systemctl status or equivalent. Verify the correct port is listening with netstat -tlnp or ss -tlnp.AbortController, xhr.abort(), or component unmount logic that might cancel in-flight requests. React's useEffect cleanup and Angular's ngOnDestroy commonly abort pending requests.JavaScript Fetch - Catching Status 0
// Fetch API - status 0 means no response received try { const response = await fetch('https://api.example.com/data'); console.log(response.status); // 0 if blocked/failed console.log(response.type); // "opaque" for CORS issues } catch (error) { // Network errors throw a TypeError console.error('Request failed:', error.message); // "Failed to fetch" - CORS or network error // "The user aborted a request" - AbortController } // Proper error handling with AbortController const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 5000); try { const response = await fetch('https://api.example.com/data', { signal: controller.signal }); clearTimeout(timeout); } catch (error) { if (error.name === 'AbortError') { console.error('Request timed out'); } else { console.error('Network error (status 0)', error); } }
XMLHttpRequest - Detecting Status 0
const xhr = new XMLHttpRequest(); xhr.open('GET', 'https://api.example.com/data'); xhr.onload = function() { if (xhr.status === 0) { console.error('No response - CORS or network error'); } else { console.log('Response:', xhr.status); } }; xhr.onerror = function() { // xhr.status is 0 here console.error('Network error - request never completed'); }; xhr.send();
curl - Connection Failures
# Connection refused (server not running) $ curl -v https://not-running.example.com curl: (7) Failed to connect: Connection refused # DNS failure (domain doesn't exist) $ curl -v https://nonexistent.invalid curl: (6) Could not resolve host: nonexistent.invalid # SSL certificate error $ curl -v https://expired-cert.example.com curl: (60) SSL certificate problem: certificate has expired # Timeout (server unresponsive) $ curl -v --connect-timeout 5 https://slow.example.com curl: (28) Connection timed out after 5001 milliseconds # All of these result in "status 0" - no HTTP response
Browser Console Errors to Watch For
// CORS error (most common cause of status 0) Access to fetch at 'https://api.example.com/data' from origin 'https://mysite.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present. // Mixed content blocked Mixed Content: The page at 'https://mysite.com' was loaded over HTTPS, but requested an insecure resource 'http://api.example.com'. This request has been blocked. // Network error GET https://api.example.com/data net::ERR_CONNECTION_REFUSED // DNS failure GET https://bad-domain.invalid/data net::ERR_NAME_NOT_RESOLVED
Access-Control-Allow-Origin header, so the browser blocks access to the response. Other causes include: the network connection is lost, the request was aborted via AbortController, a browser extension blocked the request, or the server is completely unreachable. Check the browser Console tab (not just the Network tab) for the specific error message, which will tell you exactly what went wrong.status === 0 for the same reasons as the Fetch API: CORS violations, network errors, aborted requests, blocked requests from extensions, DNS failures, and SSL/TLS errors. One additional cause specific to XMLHttpRequest: it returns status 0 when using the file:// protocol (opening HTML files directly from disk rather than from a web server). The same-origin policy blocks all XHR requests from file:// origins. The fix is to serve your files from a local development server (python -m http.server, npx serve, or your framework's dev server) instead of opening them directly.Catch connection failures, CORS issues, and downtime before your users do. HTTP Tiger monitors your URLs and alerts you when something goes wrong.
Start Monitoring Free