0

No Response / Network Error

The request never reached the server. The client could not establish a connection.

Not an official HTTP status code

Quick Definition

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.

When It Occurs

Status code 0 appears across many different contexts where HTTP requests are made:

  • Browser Fetch API and XMLHttpRequest - JavaScript code making API calls receives a Response object with status: 0 or an XHR object with status === 0 when the request is blocked or fails at the network level
  • curl with --fail flag - When curl cannot connect to the server, it returns exit code 7 (connection refused) or 6 (DNS failure), and the HTTP status is effectively 0 since no response was received
  • API clients and SDKs - Libraries like Axios, requests (Python), HttpClient (.NET), and OkHttp (Java/Kotlin) report a status of 0 or throw a connection exception when the server is unreachable
  • Mobile apps - iOS and Android apps lose connectivity when the device switches networks, enters airplane mode, or moves out of cellular range, resulting in status 0 responses
  • Serverless and edge functions - Functions that make outbound HTTP calls can receive status 0 when the target service is unreachable from the function's network environment
  • Automated testing - Integration tests and end-to-end tests encounter status 0 when the test server hasn't started yet or the port is unavailable

Common Causes

  • CORS policy blocking the request - The most common cause in web applications. The browser blocks the request because the server's Access-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.
  • Network connectivity lost - WiFi disconnected, ethernet cable unplugged, airplane mode enabled, or cellular signal lost. The device has no route to the internet.
  • DNS resolution failure - The domain name doesn't exist, the DNS server is unreachable, or DNS records have expired. The client can't resolve the hostname to an IP address.
  • Request blocked by ad blocker or browser extension - Extensions like uBlock Origin, AdBlock Plus, Privacy Badger, or corporate security extensions intercept and block requests to certain domains or URL patterns.
  • SSL/TLS certificate error - The server's certificate is expired, self-signed, issued for a different domain, or uses an untrusted certificate authority. The browser refuses to establish the secure connection.
  • Server is completely down - The server process has crashed, the machine is off, or the port is not listening. The TCP connection is refused or times out with no response.
  • Request aborted or cancelled by client code - JavaScript code calls AbortController.abort(), xhr.abort(), or the user navigates away from the page before the request completes.
  • Firewall or proxy blocking the connection - A corporate firewall, WAF, or proxy server drops the connection before it reaches the destination server. Common in enterprise environments.
  • Mixed content blocking - An HTTPS page tries to load a resource over HTTP. Modern browsers block these mixed content requests silently, resulting in status 0.
  • Request timeout before any response received - The connection attempt or the request itself exceeds the client's configured timeout. The client gives up waiting and reports status 0.

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.

🛠 How to Fix

  1. Check browser DevTools Network tab - Open DevTools (F12), go to the Network tab, and reproduce the request. Look for entries marked (failed) or (canceled). Click the entry to see the error details. This tells you whether it's CORS, DNS, SSL, or a network issue.
  2. Verify CORS headers on the server - If the Console shows a CORS error, ensure the server responds with the correct Access-Control-Allow-Origin, Access-Control-Allow-Methods, and Access-Control-Allow-Headers. Test the preflight OPTIONS request separately.
  3. Test with curl to isolate the issue - Run 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.
  4. Check DNS resolution - Run 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.
  5. Verify SSL certificate validity - Run 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.
  6. Disable browser extensions temporarily - Open an incognito/private window (which disables most extensions) and retry the request. If it works in incognito, an extension is blocking the request. Re-enable extensions one by one to find the culprit.
  7. Check for mixed content issues - If your page is served over HTTPS, ensure all API calls and resource loads also use HTTPS. Look for http:// URLs in your JavaScript code and update them to https://.
  8. Verify the server is running and accessible - Try accessing the server directly in a browser tab. Check if the server process is running with systemctl status or equivalent. Verify the correct port is listening with netstat -tlnp or ss -tlnp.
  9. Check firewall and proxy settings - Verify that no firewall rules are blocking outbound connections to the target host and port. In corporate environments, check proxy configuration and any URL filtering policies.
  10. Inspect client code for request cancellation - Search your code for 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.

💻 Code Examples

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

Frequently Asked Questions

Is 0 a real HTTP status code? +
No. Status code 0 is not defined in any HTTP RFC or the IANA HTTP Status Code Registry. Official HTTP status codes range from 100 to 599. A status of 0 is a convention used by HTTP clients (browsers, curl, programming libraries) to indicate that no HTTP response was received at all. This means the request either never left the client, was blocked before reaching the server, or the connection failed before any response data arrived. It's fundamentally different from server errors like 500 or 503, where the server actively sends an error response.
Why does fetch return status 0? +
The Fetch API returns a status of 0 when the browser blocks or cannot complete the request. The most common cause is a CORS policy violation - the server doesn't include the correct 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.
How to debug status code 0 in Chrome? +
Open Chrome DevTools with F12 or Ctrl+Shift+I. First, go to the Network tab and reproduce the failing request. Look for requests marked as "(failed)" or "(canceled)" in red. Click the request entry to see headers, timing, and error details. Then check the Console tab for CORS errors or network error messages - Chrome provides detailed error descriptions there. You can filter by "Fetch/XHR" in the Network tab to isolate API calls. If the request shows status 0 with no response headers at all, the issue is client-side. Also try reproducing in an Incognito window to rule out extension interference.
What causes XMLHttpRequest status 0? +
XMLHttpRequest reports 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.

Monitor Your Endpoints 24/7

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