When a CORS preflight (OPTIONS) is sent, and what the browser checks
In one line: The exact conditions that make the browser send OPTIONS before the real request, the three headers it carries, and the order in which the response is checked.
Half of all “the server returns 200 but the browser refuses” cases are decided at the preflight. Before sending a cross-origin request that might be unsafe, the browser sends OPTIONS to ask “will you allow this combination?”. Only if that answer is acceptable does the real request go out.
1. When a preflight is sent
If all three rows below hold, the request is a simple request and goes out without a preflight. If any one fails, a preflight is sent.
| Item | Simple-request condition |
|---|---|
| Method | GET, HEAD, POST |
| Request headers | All of them are one of Accept, Accept-Language, Content-Language, Content-Type, Range |
| Content-Type | application/x-www-form-urlencoded, multipart/form-data, text/plain |
Two things are missed most often. First, PUT, PATCH and DELETE always trigger a preflight. Second, Content-Type: application/json is not on that list, so a POST carrying JSON still gets a preflight. That is why CORS errors so often appear “only on the JSON API”.
2. What the preflight carries
OPTIONS /api/items HTTP/1.1 Origin: https://app.example.com Access-Control-Request-Method: PUT Access-Control-Request-Headers: authorization, content-type, x-api-key
Access-Control-Request-Method— the single method the real request will use.Access-Control-Request-Headers— only the header names that are not safelisted, comma separated and lower-cased.- No cookies are attached to the preflight, even with
credentials: include. The credentials rules still apply to the response, though.
3. What the response must satisfy
- Status — must be 2xx. A 301, 403, 404 or 500 is a failure by itself.
- Access-Control-Allow-Origin — the request origin exactly, or
*when credentials are not used. - Access-Control-Allow-Methods — must contain the requested method.
- Access-Control-Allow-Headers — must contain every name from
Access-Control-Request-Headers; one missing name fails the whole request. - Access-Control-Allow-Credentials — must be
truewhen the mode is include. - Access-Control-Max-Age — how long the passing preflight may be cached.
If the preflight passes, the browser sends the real request and checks Allow-Origin and Allow-Credentials again on that response. A correct preflight with a missing header on the actual response still fails.
4. Common misconceptions
- “Just return 200 to OPTIONS” — the status is not enough.
Allow-MethodsandAllow-Headersmust match the request. - “OPTIONS never reaches my server” — a CDN or proxy may answer or cache it. Check the edge configuration too.
- “The browser preflights every time” — without
Max-Agethe result is cached for 5 seconds only. Around 600 seconds removes most round trips.
5. Checking it in CorsLab
Change the method to PUT or add content-type: application/json and the banner switches to “preflight required”, with the reason listed. Remove PUT from Allow-Methods and the block, plus the exact console text, appears.
Put the same request and response into the simulator to see whether it passes and which header to change.
Open CorsLabFrequently asked questions
Can a GET request trigger a preflight?
Yes. A GET that carries Authorization or X-Custom is no longer a simple request and is preflighted. Judging by the method alone misses this case.
Does the preflight response need a body?
No. Only the status and headers matter. Answering with 204 No Content is common.
What shows up in the server log when a preflight fails?
One OPTIONS request and its response. The real request is never sent, so it looks as if the request never arrived.
Sources
- Fetch Standard — CORS protocol
- MDN — Cross-Origin Resource Sharing (CORS)
- web.dev — Cross-Origin Resource Sharing (CORS)
Read next
- Access-Control-Allow-Origin, credentials: include and the wildcard banExact-match rules for Allow-Origin, the multiple-value error, why * is forbidden with credentials, and the three headers the rule applies to.
- Simple-request checks: method, headers and Content-TypeThe Fetch Standard safelist explained value by value, including the byte rules for header values and the Range exception.
- Vary: Origin and CDN cache poisoningHow a cache that keys on the URL alone reuses the wrong response, what it looks like in both directions, and how to set Vary: Origin on each platform.