# Access-Control-Allow-Origin

> Access-Control-Allow-Origin lets other sites read your response. Fix the CORS

Canonical: https://scaplet.com/errors/browser/access-control-allow-origin

Guide Error · Browser

Access-Control-Allow-Origin lets other sites read your response. Fix the CORS 'header missing', wildcard and credentials errors with nginx and Apache config.

3 min

read

5

sources

Oct 22, 2026

updated

Scaplet Editorial Team

author

In one line

Access-Control-Allow-Origin is the response header that tells the browser whether code from a given origin may read the response. The server you call must send it. Front-end code cannot add it to someone else's response, though a proxy you control can. Set it to one exact origin, or `*` for public requests without credentials.

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fbrowser%2Faccess-control-allow-origin%20(%22Access-Control-Allow-Origin%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fbrowser%2Faccess-control-allow-origin%20(%22Access-Control-Allow-Origin%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fbrowser%2Faccess-control-allow-origin%20(%22Access-Control-Allow-Origin%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fbrowser%2Faccess-control-allow-origin%20(%22Access-Control-Allow-Origin%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 5 parts, 3 minutes.

1. [What the header does and who causes the error 01](#what-the-header-does-and-who-causes-the-error)
2. [Fix the error by message 02](#fix-the-error-by-message)
3. [Set the header in nginx and Apache 03](#set-the-header-in-nginx-and-apache)
4. [If you do not control the server 04](#if-you-do-not-control-the-server)
5. [What it does to SEO 05](#what-it-does-to-seo)

_01_The three legal values

## What the header does and who causes the error

MDN describes `Access-Control-Allow-Origin` as the response header that "indicates whether the response can be shared with requesting code from the given origin." The browser enforces it, but the server decides it. When a page on one origin calls an API on another and the header is missing or does not match, the browser blocks the page's code from reading the response. MDN notes that for security the details of a [CORS](/glossary/cors) failure are not available to JavaScript; only the browser console shows what went wrong.

Value

### `*`

Meaning

Any origin may read it

Limit

Not allowed with credentials, so cookies are not sent

Value

### `https://app.example.com`

Meaning

One specific origin

Limit

Only a single origin per response

Value

### `null`

Meaning

The origin "null"

Limit

MDN says to avoid it; sandboxed and `file:` documents have a null origin

A response that allows one origin

```
HTTP/1.1 200 OK Access-Control-Allow-Origin: https://app.example.com Vary: Origin
```

_02_Browser message, cause, fix

## Fix the error by message

Message (as MDN prints it)

### CORS header 'Access-Control-Allow-Origin' missing

Cause

The response has no such header

Fix on the server

Add the header for your front-end origin

Message (as MDN prints it)

### Credential is not supported if the CORS header 'Access-Control-Allow-Origin' is '*'

Cause

Credentialed request answered with the wildcard

Fix on the server

Return the requesting origin, not `*`; or, on the client, turn credentials off

Message (as MDN prints it)

### Multiple CORS header 'Access-Control-Allow-Origin' not allowed

Cause

The server sent more than one Access-Control-Allow-Origin header

Fix on the server

Send it once; echo back a single origin, never a list

Message (as MDN prints it)

### Request requires preflight, which is disallowed to follow cross-origin redirects

Cause

A redirect occurred after the preflight (browser dependent)

Fix on the server

Send the request to the final URL, not one that redirects

MDN's CORS guide says that after a preflighted request some browsers still report an error if a redirect occurs, because not all browsers support following redirects after a preflighted request. Serve the final URL directly instead of a [301](/errors/http/301) or [302](/errors/http/302) on API paths.

_03_Check it

## Set the header in nginx and Apache

Apache (mod_headers)

```
Header set Access-Control-Allow-Origin 'https://app.example.com'
```

The nginx form with `always` and the Apache `Header set` form are the examples MDN gives for this error. To allow several origins, MDN says the server code must read the request's `Origin` header, compare it with a list, and echo the match back, with `Vary: Origin` so caches know the response differs by origin. A wildcard is acceptable only for public resources; MDN warns against it for private APIs.

nginx

```
location /api/ { add_header 'Access-Control-Allow-Origin' 'https://app.example.com' always; }
```

_04_Good to know

## If you do not control the server

MDN says that if the remote server is not under your control and does not send the header, you cannot fix the error on the server side. Its alternatives: restructure the request as a simple request to avoid a preflight, if the server handles simple cross-origin requests; use `mode: no-cors` in `fetch()` if you do not need to read the response (the response will be opaque); or route the request through a proxy server you control, which fetches the resource and returns it with appropriate CORS headers.

Do not echo any origin blindly

Reflecting whatever `Origin` arrives, combined with credentials, lets any site read private responses. Compare against an allow-list first.

_05_Explained

## What it does to SEO

CORS is a browser rule about which scripts may read a cross-origin response, and none of the sources here describe it as an indexing rule. The risk is indirect: if a page builds its main content from a cross-origin call that fails, check what Google renders with [URL Inspection](/glossary/url-inspection-tool) in [Search Console](/glossary/google-search-console) rather than assuming. For the status codes involved, see [HTTP status codes](/glossary/http-status-codes) and the [4xx errors](/seo-issues/4xx-errors) audit page.

Sources · 5

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- mozilla.org

1. 01 [MDN: Access-Control-Allow-Origin header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Access-Control-Allow-Origin) developer.mozilla.org · checked 2026-10-25
2. 02 [MDN: Cross-Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS) developer.mozilla.org · checked 2026-10-25
3. 03 [MDN: Reason: CORS header 'Access-Control-Allow-Origin' missing](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS/Errors/CORSMissingAllowOrigin) developer.mozilla.org · checked 2026-10-25
4. 04 [MDN: Reason: Multiple CORS header 'Access-Control-Allow-Origin' not allowed](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS/Errors/CORSMultipleAllowOriginNotAllowed) developer.mozilla.org · checked 2026-10-25
5. 05 [MDN: Reason: Credential is not supported if the CORS header is '*'](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS/Errors/CORSNotSupportingCredentials) developer.mozilla.org · checked 2026-10-25

Questions

## Asked a lot.

4 questions people ask next, answered from the sources on this page.

_01_ How do I enable CORS?

Make the server send `Access-Control-Allow-Origin` with the exact origin allowed to read the response, plus the other CORS headers a preflight needs. In nginx use `add_header ... always`; in Apache use `Header set`.

_02_ What is CORS?

Cross-Origin Resource Sharing, a browser mechanism that uses HTTP headers to let a page from one origin read responses from another. Servers opt in; the browser enforces.

_03_ How do I unblock CORS in Chrome?

The fix belongs on the server. Switching off browser security flags only changes your own machine for testing and does not help real users.

_04_ Can I list several origins in the header?

No. Browsers accept a single origin (or null), per MDN. Compare the request's `Origin` with your list and return the matching one with `Vary: Origin`.

## Keep learning

[All errors](/errors)

[Learn Cross-Origin Request Blocked Browser errors](/errors/misc/cross-origin-request-blocked) [Related HTTP status codes Crawling and indexing](/glossary/http-status-codes) [Read next 403 Forbidden HTTP status codes](/errors/http/403) [Do Run a free site audit Free, about two minutes](/site-audit)

Nearby in errors
[Cross-Origin Request Blocked](/errors/misc/cross-origin-request-blocked) [Module not found: Can't resolve](/errors/misc/module-not-found-can-t-resolve)

More in Browser errors
[Access-Control-Allow-Origin](/errors/browser/access-control-allow-origin) [Aw, Snap!](/errors/browser/aw-snap) [blocked:mixed-content](/errors/browser/blocked-mixed-content) [Chrome out of memory](/errors/browser/chrome-out-of-memory) [Firefox Server Not Found](/errors/browser/firefox-server-not-found) [Firefox: "Secure Connection Failed"](/errors/browser/firefox-secure-connection-failed) [Firefox: File not found](/errors/browser/firefox-file-not-found) [Firefox: the connection has timed out](/errors/browser/firefox-the-connection-has-timed-out) [Firefox: Warning: Potential Security Risk Ahead](/errors/browser/firefox-warning-potential-security-risk-ahead) [Refused to apply style ... because its MIME type](/errors/browser/refused-to-apply-style-from-because-its-mime-type) [Safari can't find the server](/errors/browser/safari-can-t-find-the-server) [Safari can't open the page](/errors/browser/safari-can-t-open-the-page) [Safari: "This Connection Is Not Secure" and related warnings](/errors/browser/safari-this-connection-is-not-private) [SSL certificate problem: unable to get local issuer certificate](/errors/browser/ssl-certificate-problem-unable-to-get-local-issuer-certificate) [Text content does not match server-rendered HTML](/errors/browser/text-content-does-not-match-server-rendered-html) [This page isn't working](/errors/browser/this-page-isn-t-working) [This site can't provide a secure connection](/errors/browser/this-site-can-t-provide-a-secure-connection) [Uncaught ReferenceError: x is not defined](/errors/browser/uncaught-referenceerror-is-not-defined) [Uncaught TypeError: Cannot read properties of undefined](/errors/browser/uncaught-typeerror-cannot-read-properties-of-undefined) [Your connection is not private](/errors/browser/your-connection-is-not-private) [Your connection is not private in Chrome (on every site)](/errors/browser/your-connection-is-not-private-chrome)

Terms on this page
[CORS](/glossary/cors) [HTTP status codes](/glossary/http-status-codes) [URL Inspection tool](/glossary/url-inspection-tool) [Google Search Console](/glossary/google-search-console)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
