*
- Meaning
- Any origin may read it
- Limit
- Not allowed with credentials, so cookies are not sent
Access-Control-Allow-Origin lets other sites read your response. Fix the CORS 'header missing', wildcard and credentials errors with nginx and Apache config.
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.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
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.*https://app.example.comnullfile: documents have a null originHTTP/1.1 200 OK
Access-Control-Allow-Origin: https://app.example.com
Vary: Origin*; or, on the client, turn credentials offHeader 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.
location /api/ {
add_header 'Access-Control-Allow-Origin' 'https://app.example.com' always;
}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.4 questions people ask next, answered from the sources on this page.
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.
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.
The fix belongs on the server. Switching off browser security flags only changes your own machine for testing and does not help real users.
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.
Run the free audit, then approve the fixes. Every change can be undone.