Free auditStart free
GuideError · Browser

Access-Control-Allow-Origin

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 withChatGPTClaudePerplexityGoogleAI Mode
01The 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 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
03Check 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;
}
04Good 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.
05Explained

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 in Search Console rather than assuming. For the status codes involved, see HTTP status codes and the 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. 01MDN: Access-Control-Allow-Origin headerdeveloper.mozilla.org · checked 2026-10-25
  2. 02MDN: Cross-Origin Resource Sharing (CORS)developer.mozilla.org · checked 2026-10-25
  3. 03MDN: Reason: CORS header 'Access-Control-Allow-Origin' missingdeveloper.mozilla.org · checked 2026-10-25
  4. 04MDN: Reason: Multiple CORS header 'Access-Control-Allow-Origin' not alloweddeveloper.mozilla.org · checked 2026-10-25
  5. 05MDN: Reason: Credential is not supported if the CORS header is '*'developer.mozilla.org · checked 2026-10-25
Questions

Asked a lot.

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

01How 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.

02What 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.

03How 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.

04Can 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.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

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

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane