GET with no custom headers
- Preflight?
- No
- Example
fetch("https://bar.other")
CORS is the header mechanism that lets a server allow cross-origin reads from browser scripts. Preflights, credentials rules, the wildcard trap, and a curl check.
CORS (cross-origin resource sharing) is an HTTP-header mechanism that lets a server tell browsers which other origins may read its responses from JavaScript. Browsers block cross-origin reads by default under the same-origin policy. The server opts in with headers such as Access-Control-Allow-Origin.
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.
OPTIONS request, called a preflight. MDN lists what keeps a request simple: the method is GET, HEAD or POST, only CORS-safelisted headers are set by hand, and Content-Type is application/x-www-form-urlencoded, multipart/form-data or text/plain.GET with no custom headersfetch("https://bar.other")POST with Content-Type: text/plainPOST with Content-Type: application/jsonX-PINGOTHER: pingpongPUT or DELETEOriginAccess-Control-Request-MethodAccess-Control-Request-HeadersAccess-Control-Allow-Origin* for requests without credentialsAccess-Control-Allow-MethodsAccess-Control-Allow-HeadersAccess-Control-Max-AgeOPTIONS /doc HTTP/1.1
Host: bar.other
Origin: https://foo.example
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type,x-pingother
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://foo.example
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: X-PINGOTHER, Content-Type
Access-Control-Max-Age: 86400
Vary: Accept-Encoding, OriginMDN says the default Access-Control-Max-Age is 5 seconds and that browsers cap the value they accept. Without a longer value, browsers repeat the OPTIONS call often.
Preflight requests never include credentials, yet the preflight response must still allow them. When you pick the allowed origin dynamically from a list, send Vary: Origin too, so shared caches keep one response per requesting origin. See HTTP caching.
Access-Control-Allow-Origin your exact page origin, or * when no cookies are involved?Vary: Origin appear when you echo the origin?curl -si -X OPTIONS https://api.example.com/items \
-H 'Origin: https://app.example.com' \
-H 'Access-Control-Request-Method: POST' \
-H 'Access-Control-Request-Headers: content-type' \
| grep -i -E '^(HTTP|access-control|vary)'2 questions people ask next, answered from the sources on this page.
No. CORS only controls whether scripts in a browser can read a response. MDN says servers still need their own defenses, such as CSRF protection, because simple requests can be sent cross-site like form submissions.
Yes in some cases. MDN lists images with the crossorigin attribute, module scripts, web fonts, WebGL textures and canvas reads as places CORS applies beyond fetch and XMLHttpRequest.
The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.