Modern web applications call APIs on other domains all the time: a front-end on app.example.com reads data from api.example.com, a widget loads JSON from a partner. Browsers allow that only when the API says so with CORS headers. When CORS is too strict, the application breaks; when it is too loose, other websites can read data they should not.
The CORS Checker sends a URL test requests with different Origin headers, shows the exact CORS headers that come back, and explains what a browser would allow — for simple, preflighted and credentialed requests.
What is CORS?
In simple terms
By default, a script on one website cannot read responses from another website. CORS (Cross-Origin Resource Sharing) is how a server tells browsers: “these other websites may read my responses”.
Technical background
Browsers enforce the same-origin policy. An Origin is the combination of scheme, host name and port — https://app.example.com and http://app.example.com are different Origins, and so are https://example.com and https://example.com:8443. A path is never part of an Origin.
When a page makes a cross-origin request with fetch() or XMLHttpRequest, the browser adds an Origin header. The server answers with Access-Control-* headers, and the browser checks them (the “CORS check” of the WHATWG Fetch standard) before handing the response to JavaScript. CORS relaxes the same-origin policy; it never makes anything stricter.
The CORS headers
- Access-Control-Allow-Origin — exactly one Origin, or
*. A comma-separated list is invalid. The value must match the requesting Origin byte for byte. - Access-Control-Allow-Credentials —
trueallows requests that carry cookies or HTTP authentication. It cannot be combined withAllow-Origin: *. - Access-Control-Allow-Methods and Access-Control-Allow-Headers — sent in answer to a preflight: which methods and request headers are allowed.
Authorizationmust always be listed by name;*does not cover it. - Access-Control-Expose-Headers — which response headers JavaScript may read beyond the safelisted ones (Cache-Control, Content-Language, Content-Length, Content-Type, Expires, Last-Modified, Pragma).
- Access-Control-Max-Age — how long a preflight result may be cached. Chromium-based browsers cap it at 2 hours, Firefox at 24 hours.
- Vary: Origin — tells caches that the response differs per Origin.
Simple requests and preflights
A simple request is a GET, HEAD or POST that only sets safelisted headers and, for POST, uses one of three Content-Types: application/x-www-form-urlencoded, multipart/form-data or text/plain. Browsers send it straight away. CORS then only decides whether JavaScript may read the response — the server has already received and processed the request.
Everything else needs a preflight: an OPTIONS request with Access-Control-Request-Method and Access-Control-Request-Headers. Only if the answer has a 2xx status and allows the Origin, method and headers does the browser send the real request. Typical triggers are PUT and DELETE, Content-Type: application/json and an Authorization header.
A successful preflight is not the end: the actual response must pass the CORS check as well.
Credentialed requests
With fetch(url, { credentials: 'include' }) the browser sends cookies and HTTP authentication. The rules are stricter:
Access-Control-Allow-Originmust name the exact Origin —*is rejected.Access-Control-Allow-Credentials: truemust be present.*in Allow-Methods, Allow-Headers and Expose-Headers loses its wildcard meaning.
Cookie rules apply on top: SameSite cookies and third-party cookie blocking can stop cookies from being sent at all.
Why use a CORS checker?
- Debug “blocked by CORS policy” errors by seeing the exact headers and the failed rule.
- Check that a new API only allows the front-ends it should.
- Find dangerous policies: reflected Origins with credentials, a trusted
nullOrigin, unanchored subdomain matching. - Document the CORS behaviour of an endpoint for a security review.
Who should use it?
Front-end and back-end developers, API owners, DevOps engineers who configure proxies and CDNs, and security engineers reviewing web applications.
How the NetTools.tech CORS Checker works
The NetTools server requests the URL once per test Origin with an Origin header — GET or HEAD only — and, when the request needs one, sends an OPTIONS preflight. Redirects are followed as a browser follows them: every hop must pass the CORS check, and after a cross-origin redirect the Origin becomes null. Your browser then evaluates the responses with a model of the browser’s CORS rules.
Besides your Origin, the tool tests automatic trust probes:
- an unrelated Origin under the reserved
.exampledomain, which nobody can own; - a made-up subdomain of the site;
- the trusted name followed by another domain, and a look-alike domain that ends with the trusted name;
- the same host with the other scheme (http or https);
- the
nullOrigin.
If the unrelated Origin is allowed, the server reflects arbitrary Origins.
This is server-side header inspection with a browser-access model, not an actual browser enforcement test. The page also offers an actual browser test, which runs fetch() in your browser — but that can only use this website’s own Origin.
How to use the CORS Checker
- Open the CORS Checker and enter the API URL, e.g.
https://example.com/api/users. - Choose the Origin of the front-end, or a preset.
- Pick a mode: Basic, Preflight, Credentialed or Custom request (method, headers, Content-Type).
- Press Run CORS test and read the overall status and the browser decision.
- Use the policy view to follow each step of the browser’s decision, and the comparison table to see how the server treats other Origins.
- Review the findings and copy a configuration example for your server.
- Export the report as PDF, CSV or JSON.
Understanding the results
The overall status summarises the test: configured (the selected Origin can make the request and read the response), partially configured (CORS headers exist but this request is blocked, often by the preflight), restrictive (no tested Origin may read responses), misconfiguration detected, unavailable or inconclusive. The comparison table shows, per Origin, the returned Allow-Origin and credentials values, whether a simple and a credentialed read would be allowed, and the preflight result; cells that differ from the selected Origin are highlighted.
Example: an API behind a single front-end
An API at https://api.example.com/v1/orders should be used only by https://app.example.com, with cookies. A correct configuration returns Access-Control-Allow-Origin: https://app.example.com, Access-Control-Allow-Credentials: true and Vary: Origin for that Origin, and no Allow-Origin header for anyone else. In the checker, the selected Origin shows “Allowed”, while the unrelated, subdomain, look-alike, http and null probes all show “Blocked”. If the unrelated probe also shows “Allowed” with credentials, the server reflects every Origin — the most common serious CORS bug.
Common use cases
- Diagnosing a CORS error in a single-page application after a deployment.
- Verifying a proxy or CDN does not strip or duplicate CORS headers.
- Reviewing third-party APIs before integrating them.
- Security reviews of authenticated APIs.
Troubleshooting
The preflight fails with 401 or 403
The authentication middleware runs before the CORS handler and rejects the OPTIONS request, which never carries credentials. Let preflights through without authentication.
Two Access-Control-Allow-Origin values
Both the application and the proxy add the header. Set it in one place only.
It works in curl but not in the browser
curl does not enforce CORS. Compare Allow-Origin with the exact Origin of the page, including scheme and port, and check the preflight.
Understanding the findings
- Arbitrary Origin reflection — the server copies any Origin into Allow-Origin. With credentials this is potentially dangerous: any site a logged-in user visits could read authenticated responses. Without credentials it behaves like
*. - Wildcard Origin — fine for public data; informational unless the endpoint looks private.
- Wildcard with credentials — browsers reject it, so the credentials header has no effect.
- null Origin allowed — any site can produce
Origin: nullwith a sandboxed iframe, so trusting it is close to trusting everyone. - Broad subdomain or look-alike trust — a compromised subdomain, or a registered look-alike domain, gains access.
- Missing Vary: Origin — a shared cache may serve one Origin’s headers to another.
- http:// Origin trusted — network attackers can inject script into unencrypted pages.
Severity depends on the evidence: whether credentials are allowed, what the response looks like, and whether the observation is a heuristic. A permissive header is not automatically an exploitable vulnerability — impact depends on what the endpoint returns and how users authenticate.
CORS versus CSRF
CORS controls reading responses. It does not stop a browser from sending simple requests: a form on another site can still POST to your server. Protect state-changing requests against cross-site request forgery with SameSite cookies, CSRF tokens or by requiring a non-simple request (for example a JSON body or a custom header), which forces a preflight.
Common mistakes
- Returning a list of Origins in one Access-Control-Allow-Origin header.
- Reflecting the Origin header without checking it against an allowlist.
- Matching Origins with
endsWith("example.com")or an unescaped regular expression. - Setting CORS headers both in the application and in nginx, which produces duplicate headers.
- Forgetting the OPTIONS handler, or letting authentication reject preflights.
- Treating CORS as access control.
Why curl and browser results differ
curl sends exactly the headers you give it and prints the answer; it never applies the CORS check. Browsers add their own headers, apply the safelist rules, follow redirects with Origin tainting, enforce mixed-content blocking and cookie policies. Use curl to see what the server sends, and the checker or a browser to see what a page may read.
Limitations
The checker sends only GET, HEAD and OPTIONS requests. For POST, PUT, PATCH and DELETE it tests the preflight and uses the GET response as a stand-in for the actual response. It never sends cookies or tokens, so responses for logged-in users may differ. Private and internal addresses cannot be tested.
Security & privacy
URLs are checked against private, local and reserved addresses, every redirect hop is re-checked, and connections go to the checked address. At most 40 requests are sent per test, only 1 KB of each body is read and discarded, and results are not stored.
Related tools
- Web Pentest & Security Assessment — headers, cookies, TLS and exposed files.
- SSL Certificate Checker — the TLS side of the same endpoint.
- Redirect Checker — follow redirect chains hop by hop.
- HTTP Status Checker — status codes and response headers.
- Website Screenshot — see how a page renders.
Summary
CORS lets servers allow selected websites to read their responses in the browser. A good policy names exact Origins, allows credentials only where needed, lists only the methods and headers the client uses, and sends Vary: Origin. The NetTools.tech CORS Checker shows the real headers, models the browser’s decision and points out policies that are too broad — while making clear what was tested on the server and what a browser would do.
Frequently asked questions
What does “blocked by CORS policy” mean?
The browser sent the request, but the response did not carry CORS headers that allow the page’s Origin to read it, so the browser withheld the response from JavaScript. The server may still have processed the request.
Is Access-Control-Allow-Origin: * insecure?
Not by itself. A wildcard lets any website read responses to requests without credentials, which is fine for public APIs and assets. It cannot be used with cookies or HTTP authentication.
Why does my request trigger an OPTIONS preflight?
Because it is not a simple request: it uses a method other than GET, HEAD or POST, a Content-Type such as application/json, or a header such as Authorization. The browser asks the server first whether that is allowed.
Does curl show whether CORS works?
curl shows the headers the server sends, but it does not enforce CORS. A successful curl request does not prove that browser JavaScript may read the response.
Does CORS protect my API from attackers?
No. CORS only controls which websites may read responses in a browser. Scripts, servers and command-line tools ignore it. Every request still has to be authenticated and authorized on the server.
Why must I send Vary: Origin?
When the Access-Control-Allow-Origin value depends on the request’s Origin, caches must store a separate copy per Origin. Without Vary: Origin, a cache can serve one site’s CORS headers to another.