Tools / CORS policy

CORS policy checker

See how an endpoint responds to a cross-origin request and browser preflight, including whether it reflects arbitrary origins or allows credentials.

What it checks

This is a passive header check, not an exploit. A permissive policy is not automatically a vulnerability; risk depends on the data and actions available from the endpoint.

What CORS actually protects — and what it does not

CORS is the single most misread security header on the web, so it is worth being blunt about what it does. The same-origin policy stops JavaScript on a.com from reading a response from b.com. CORS is how b.com opts out of that restriction for chosen callers. It is a relaxation of a browser rule, not a protection you add.

Three consequences follow, and each one surprises somebody:

Simple requests and preflight

A request is simple — sent straight away, no preflight — when it uses GET, HEAD or POST, carries only a short list of headers, and its Content-Type is application/x-www-form-urlencoded, multipart/form-data or text/plain. Anything else triggers a preflight: the browser first sends OPTIONS with Access-Control-Request-Method and Access-Control-Request-Headers, and only sends the real request if the reply approves it.

This is why Content-Type: application/json matters. A JSON API is preflighted, so the browser asks permission before the request lands. The same endpoint accepting text/plain can be hit without any preflight at all — a common way a supposedly protected API turns out to be reachable from any page.

The headers that decide the outcome

Five misconfigurations we find most often

1. Reflecting whatever Origin arrives, with credentials enabled. Because * cannot be used with credentials, a quick fix is to echo the request's Origin back and set Allow-Credentials: true. That grants every site on the internet the right to make authenticated requests as your logged-in user and read the replies. This is the single highest-impact CORS finding, and it is common.

2. Origin validation by substring. Allowlists built with “starts with”, “ends with” or a loose regex are routinely bypassable. Matching the end of the string lets evil-example.com through when you meant example.com; matching the start lets example.com.attacker.net through. Compare the full origin against an exact allowlist instead.

3. Trusting null. Sandboxed iframes, data: URLs and some redirect chains send Origin: null. An attacker can produce that origin deliberately, so Access-Control-Allow-Origin: null is an open door rather than a safe default.

4. Missing Vary: Origin behind a shared cache. If the allowed origin is chosen per request but the response is cached without varying on Origin, a CDN can serve a response approving one origin to a visitor from another. The policy is correct and the cache defeats it.

5. Trusting every subdomain. A wildcard over *.example.com means an XSS or a forgotten staging host on any subdomain becomes a route into the API. Subdomains are rarely all equally trustworthy.

Reading your result

Judge a policy by what sits behind the endpoint. Allow-Origin: * on a public, unauthenticated, read-only endpoint — a font, a public price list, an open data feed — is fine and intentional. The same header on an endpoint that returns user data, or any policy that pairs a broad origin with credentials, deserves attention. Our probe sends an ordinary cross-origin request from a throwaway origin; it does not authenticate, and it never tries to exploit what it finds.

Fixing a permissive policy

Related checks: security headers analyzer and CSP evaluator. Running an API that browsers call cross-origin? We test authentication and authorisation across APIs as part of a scoped engagement.

Frequently asked questions

How do I fix “No ‘Access-Control-Allow-Origin’ header is present”?

The server you are calling must add Access-Control-Allow-Origin with your site’s origin to its response, and answer the OPTIONS preflight for non-simple requests. The fix is always on the API side; nothing in the calling page can override it.

Is Access-Control-Allow-Origin: * safe?

For public, read-only data that needs no login — fonts, open APIs, public JSON — yes. It is unsafe only when combined with responses that depend on cookies or other credentials, which browsers block anyway for *, so teams often switch to reflecting the origin instead. That reflection is the dangerous pattern.

Why is reflecting the request’s Origin header risky?

If the server copies any Origin back and also sends Access-Control-Allow-Credentials: true, every website a signed-in user visits can read that user’s data from your API. Check origins against an explicit allow-list instead.

Does this check log in or send any attack traffic?

No. It sends one cross-origin GET and one preflight from a test origin, without cookies or credentials, and reports the headers that come back.