---
title: "CORS error in the console: a missing header or a failed server? | Proofline"
description: "A CORS error means the browser withheld a response from the page, not that CORS is misconfigured."
url: https://proofline.sh/learn/cors-error-or-server-error/
---

[Learning center](/learn/)

# CORS error in the console: a missing header or a failed server?

A CORS error means the browser withheld a response from the page, not that CORS is misconfigured. A failing server often sends its error without CORS headers, so read the real status before changing CORS settings.

Network outages The Proofline team November 20, 2026 5 min read

## What the browser actually reported

In this local reproduction, a page on `http://localhost:8101` calls an API on `http://127.0.0.1:8102`. Different ports make different origins. The API returned `502 Bad Gateway` with an HTML error page and no `Access-Control-Allow-Origin` header. Chromium printed:

```
Access to fetch at 'http://127.0.0.1:8102/api/fail-no-acao' from origin
'http://localhost:8101' has been blocked by CORS policy: No
'Access-Control-Allow-Origin' header is present on the requested resource.

Failed to load resource: net::ERR_FAILED
```

The page's `fetch` rejected with `TypeError: Failed to fetch`. The `502` appears nowhere the page can read it. The Network panel's Status column shows `CORS error` for such requests. [Network panel Status values](https://developer.chrome.com/docs/devtools/network/reference)

When the same API sent the `502` _with_ `Access-Control-Allow-Origin: http://localhost:8101`, the page received it normally: `fetch` resolved with `status` 502 and the Console printed `Failed to load resource: the server responded with a status of 502 (Bad Gateway)`.

The browser behaves correctly in both cases. The Fetch standard only lets a page read a cross-origin response that passes the CORS check, and an error page without the header fails it. [Fetch standard: CORS check](https://fetch.spec.whatwg.org/#cors-check) · [MDN: CORS errors](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS/Errors)

## Two causes behind the same message

|  | Cause A: CORS is not configured for this origin or request | Cause B: the server failed, and its error response lacks CORS headers |
| --- | --- | --- |
| Does it ever work? | Never from this origin, or never with this method or header | Works most of the time, fails under load, during deploys or on specific inputs |
| Status outside the browser | `2xx` without `Access-Control-Allow-Origin`, or with a value for another origin | `5xx`, often from a proxy or load balancer, with an HTML body |
| Where the fix goes | The API's CORS configuration | The failing service, and its error responses' headers |

The deciding observation is the status the server actually returned to the failing request. The page cannot read it, so read it outside the page: in the server or proxy log for that request, or in a replay made while the failure is happening.

## Read the real status

**Replay with curl.** In the Network panel, right-click the failed request and choose **Copy > Copy as cURL**. Run it in a terminal with `-i` added, so the status line and headers print. The copied command already carries the `Origin` header the browser sent. [Copy as cURL](https://developer.chrome.com/docs/devtools/network/reference)

```
curl -i 'http://127.0.0.1:8102/api/fail-no-acao' -H 'Origin: http://localhost:8101'
```

```
HTTP/1.1 502 Bad Gateway
Content-Type: text/html
```

A replay shows what the server returns at the moment of the replay, not what it returned to the browser's request. Replay while the browser is still failing, and record both times. A `5xx` then points at Cause B, and a `2xx` without `Access-Control-Allow-Origin` points at Cause A. When the failure is intermittent, a later replay can return `200` after the original got a `503`, so confirm the cause against the log entry for the original request. The [curl replay guide](/learn/replay-browser-request-curl/) covers copying cookies and tokens with care.

**Check the server or proxy log** for the original request's time and path. This is the record of the response the browser actually got. A request that never reached the application but appears in the load balancer's log with `502` is Cause B too.

## Preflight failures read differently

A request with a JSON `Content-Type`, a custom header or a method other than `GET`, `HEAD` or `POST` needs a preflight: the browser first sends an `OPTIONS` request and only sends the real request if the preflight passes. [MDN: preflighted requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#preflighted_requests)

In the reproduction, the preflight to `/api/preflight-fails` got a `404` without CORS headers. Chromium printed:

```
Access to fetch at 'http://127.0.0.1:8102/api/preflight-fails' from origin
'http://localhost:8101' has been blocked by CORS policy: Response to preflight
request doesn't pass access control check: No 'Access-Control-Allow-Origin'
header is present on the requested resource.
```

The words _Response to preflight request_ tell you the real request was never sent. Replay the `OPTIONS` request with curl, including `Access-Control-Request-Method` and `Access-Control-Request-Headers`, to see what the server returns for it. A route that has no `OPTIONS` handler, or an authentication layer that rejects the unauthenticated preflight, is a common reason.

## Worked example: CORS errors only during deploys

This example is fictional. A dashboard calls `api.example.test` from `app.example.test`. Users report occasional CORS errors on the **Refresh** button. CORS settings have not changed in months.

The Copy as cURL replay during the next deploy, while the dashboard showed the error, returned `HTTP/1.1 503 Service Unavailable` from the load balancer, with an HTML body and no CORS headers. Outside deploys, the same command returned `200` with `Access-Control-Allow-Origin: https://app.example.test`. The load balancer's log held a `503` for each reported failure's request, at the times users gave.

The report said: _during deploys, the load balancer returns `503` without CORS headers, so the browser reports a CORS error. CORS for this origin is configured correctly._ The fix went to the deploy's draining and health checks. A second change made the client show "Service temporarily unavailable" when `fetch` rejects, instead of leaving the button spinning.

## What to put in the report

-   The exact console message, including whether it mentions a preflight.
-   The page's origin and the request's URL and method.
-   The status and headers from a curl replay, with the time of the replay and of the original failure.
-   The log entry for the original request, if you can read it.
-   Whether the same request ever succeeds, and when it fails.
-   What you could not check, such as the server's own log.

## Questions

### Should I add `Access-Control-Allow-Origin: *` to fix it?

Not before you know the real status. If the server failed, a wildcard only lets the page read the failure. A wildcard also cannot be used with credentialed requests. [MDN: credentialed requests and wildcards](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#credentialed_requests_and_wildcards)

### Why does the request work in curl or Postman?

CORS is enforced by browsers. Tools outside the browser do not apply it, which is what makes them useful for reading the status. A request that works in curl and fails in the page, with a `2xx` and no CORS header in curl's output while the page is still failing, is a CORS configuration problem. If the page has stopped failing by the time you replay, the replay says nothing about the original response; read the log for it.

### Does a CORS error mean the server did not process the request?

No. For a request without a preflight, the server receives and may act on it; the browser only withholds the response from the page. A `POST` that the browser reports as a CORS error may still have written data. Check the server's records before you retry.

Return to the [method for browser bug reports](/learn/browser-bug-report-evidence/) for the other symptoms in this collection.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Turn a browser symptom into a bug report another engineer can act on](/learn/browser-bug-report-evidence/)
    
    Network outages The Proofline team November 20, 2026 7 min read
    
-   ### [Browser or server? Replay the failing request outside the page](/learn/replay-browser-request-curl/)
    
    Network outages The Proofline team November 20, 2026 5 min read
