Security · cross-origin requests
CORS preflight.
Describe the request, paste the server's response headers, and see the decision a browser would make and the exact check that fails. Nothing is fetched or uploaded.
Request and response
Browser decision
Run the check to see each step.
What this checks
- Simple-request test: safelisted method and headers
- Content-Type essence, 128-byte and 1024-byte header limits
- Access-Control-Allow-Origin exact match, * with credentials
- Allow-Credentials, Allow-Methods, Allow-Headers, Authorization
- Preflight status and Access-Control-Max-Age (default 5 s)
Scope: this replays the Fetch Standard algorithm on the headers you paste. It does not contact your server, cannot see what a proxy or CDN changes in transit, and browsers add their own caps and extra rules (for example private-network access). Confirm with a real request in browser DevTools.
What a CORS preflight is
Browsers stop a script on one origin from reading a response from another origin unless the other server opts in with CORS headers. For requests that could have side effects, the browser first sends a preflight: an automatic OPTIONS request carrying Origin, Access-Control-Request-Method and, when your code sets unusual headers, Access-Control-Request-Headers. Only if the server's answer allows the method and headers does the browser send the real request. You do not write the preflight yourself, and you cannot skip it from JavaScript; you can only make the server answer it correctly. This page replays that decision from the values you enter, so you can see which check fails without deploying anything.
When a preflight happens at all
A request skips the preflight only if it is "simple": the method is GET, HEAD or POST; the only headers your code sets are the CORS-safelisted ones (Accept, Accept-Language, Content-Language, Content-Type and a single-range Range); and any Content-Type is application/x-www-form-urlencoded, multipart/form-data or text/plain. The Fetch Standard also caps each safelisted header value at 128 bytes and the safelisted values together at 1,024 bytes. Anything else triggers a preflight. The two usual surprises are Content-Type: application/json, which is not safelisted, and an Authorization header.
How the check works, step by step
- The tool decides whether your method and headers make the request simple. If so, no preflight is needed and only the actual response headers matter.
- If a preflight is needed, it checks that the preflight status is an "ok" status (200 to 299). A 301, 401, 403 or 500 on the
OPTIONSrequest fails the whole exchange. Access-Control-Allow-Originmust equal your page origin exactly (scheme, host and port), or be*for a request without credentials.- For credentialed requests (cookies or HTTP authentication), the response must also send
Access-Control-Allow-Credentials: true, and the wildcard*is not allowed for the origin, headers or methods. Access-Control-Allow-Methodsmust list the method (the safelisted methods are always allowed) andAccess-Control-Allow-Headersmust list each unsafe header you set. TheAuthorizationheader is special: a*in Allow-Headers does not cover it, so it must be named.Access-Control-Max-Agesays how long the browser may cache the preflight result. If you omit it, the default is 5 seconds, so a chatty API repeats theOPTIONScall constantly.
Worked example
A page at https://app.example.com calls PUT https://api.example.com/items/7 with Content-Type: application/json and Authorization: Bearer token, without cookies. Both the method and the headers are unsafe, so a preflight happens. The API answers OPTIONS with status 204 and Access-Control-Allow-Origin: https://app.example.com, Access-Control-Allow-Methods: GET, PUT and Access-Control-Allow-Headers: Content-Type. Origin passes, method passes, Content-Type passes, but Authorization is missing from the allowed headers, so the browser blocks the request and the PUT never leaves. The fix is on the server: add Authorization to Access-Control-Allow-Headers. Changing the front-end code cannot fix it.
Common mistakes
- Allowing
*and also sending cookies. With credentials the wildcard is rejected, so echo the specific origin instead, and addVary: Originso caches keep the answers apart. - Returning the CORS headers only on the actual
GETorPOSTand not on theOPTIONSresponse. - Putting the preflight route behind authentication. The browser sends no credentials on the preflight, so a 401 there fails every request.
- Believing CORS protects the server. It only controls whether a script can read the response. A simple cross-origin request still reaches your server, so it does not replace authentication or CSRF protection.
- Testing from curl or a server-side script. Those never apply CORS, so a request that works there can still fail in a browser.
What this tool does not cover
It does not contact your server and cannot see what a proxy, CDN or gateway changes in transit. Browsers also apply their own caps (Chromium limits the preflight cache to 2 hours, Firefox to 24 hours) and extra rules such as private-network access. Confirm the final answer with a real request in your browser's developer tools. For related header work, see the CSP generator and the security headers analyzer.
Common mix-ups
-
Often assumedCORS stops other websites from sending requests to my server.
What the source saysMDN explains that simple requests need no preflight, because a form could already send them to any origin. The server still receives them; Access-Control-Allow-Origin only controls whether the calling script may read the response. [1]
-
Often assumedAccess-Control-Allow-Origin: * works for requests that send cookies.
What the source saysMDN states that for a credentialed request the server must name an explicit origin instead of the * wildcard, and the same goes for Access-Control-Allow-Headers. [1]
-
Often assumedI can list several allowed origins, separated by commas, in Access-Control-Allow-Origin.
What the source saysMDN gives the syntax as a single origin or the * wildcard. To support several origins, compare the request's Origin against an allowlist and echo back the match, adding Origin to the Vary header. [1]
Checked against these sources on .
Frequently asked questions
What is a CORS preflight request?
It is an automatic OPTIONS request that the browser sends before certain cross-origin requests, asking the server whether the real method and headers are allowed. The request carries Origin, Access-Control-Request-Method and, if needed, Access-Control-Request-Headers. The real request is only sent if the response approves it.
Why does my request send an OPTIONS request first?
Your request is not a simple request. Using a method other than GET, HEAD or POST, setting a header outside the safelisted set, or sending a Content-Type such as application/json all trigger a preflight. Adding an Authorization header does too.
How do I fix a CORS error about a header not being allowed?
Add the header name to Access-Control-Allow-Headers in the response to the OPTIONS request, not just the final response. Authorization must be listed by name, because the wildcard does not cover it. Then reload and test again.
Can I use Access-Control-Allow-Origin: * with cookies?
No. For requests with credentials the browser rejects the wildcard. Return the exact requesting origin, send Access-Control-Allow-Credentials: true, and add Vary: Origin so that caches do not serve one origin's answer to another.
How long does the browser cache a preflight?
Access-Control-Max-Age sets the number of seconds, and the default is 5 if you leave it out. Browsers cap the value: Chromium at 2 hours and Firefox at 24 hours. A larger value cuts repeated OPTIONS traffic, but changes to your CORS policy take longer to be seen.
Does the preflight response need a specific status code?
It must be an ok status, meaning 200 to 299, and 204 is common. Redirects, 401, 403 and 5xx responses make the browser treat the preflight as failed. Make sure authentication middleware and routing allow OPTIONS.
Why does the request work in curl or Postman but fail in the browser?
CORS is enforced by browsers. Tools like curl and Postman never perform the check, so they show only that the server responds. The browser also requires the right CORS headers before it lets your script read the answer.
Sources
- MDN: Cross-Origin Resource Sharing (CORS): simple requests, safelisted headers, preflight, credentials and wildcard rules (retrieved 2026-10).
- MDN: Preflight request: OPTIONS request and the request headers it carries (retrieved 2026-10).
- MDN: Access-Control-Max-Age: default 5 seconds; Firefox 24 hours, Chromium 2 hours (retrieved 2026-10).
- MDN: Access-Control-Allow-Origin: wildcard with credentials, Vary: Origin (retrieved 2026-10).
- WHATWG Fetch Standard: CORS protocol, 128-byte and 1,024-byte limits, Authorization non-wildcard rule, ok-status requirement (retrieved 2026-10).