CORS Preflight Request Reference

OPTIONS preflight request/response header flow with wildcard and credential rules.

Reference and analyzer for the CORS preflight (OPTIONS) flow — Access-Control-Request and Access-Control-Allow header pairs, simple vs preflighted requests, wildcard and credential rules.

What is a CORS preflight request?

A preflight is an automatic OPTIONS request the browser sends before the real cross-origin request, to ask the server whether the actual method and headers are allowed. The server answers with Access-Control-Allow-* headers; only if they permit the request does the browser send it.

The CORS preflight flow

Before a cross-origin request that is not “simple”, the browser sends an automatic OPTIONS preflight asking the server which method and headers are allowed. This reference pairs every Access-Control-Request-* header with the Access-Control-Allow-* response the server must return, and an analyzer tells you whether a given request preflights.

How it works

The browser preflights when the request uses a non-safelisted method or header. The preflight is an OPTIONS carrying the intended method and headers:

OPTIONS /api/data HTTP/1.1
Origin: https://app.example
Access-Control-Request-Method: PUT
Access-Control-Request-Headers: content-type, authorization

The server must answer with matching allow headers:

Access-Control-Allow-Origin: https://app.example
Access-Control-Allow-Methods: GET, PUT, DELETE
Access-Control-Allow-Headers: content-type, authorization
Access-Control-Max-Age: 600

A request that uses only GET/HEAD/POST, safelisted headers and a safelisted Content-Type is “simple” and skips the preflight entirely.

Tips and notes

  • With credentials, never use * — echo the exact Origin and set Allow-Credentials: true.
  • Access-Control-Max-Age caches the preflight; browsers cap the value.
  • List every custom request header in Access-Control-Allow-Headers.
  • Access-Control-Expose-Headers lets JS read non-safelisted response headers.