Most CORS issues come from one mismatch: origin, method, headers, or credentials.

Core response headers

Access-Control-Allow-Origin: https://app.example.com
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials: true

Preflight (OPTIONS)

Browser sends OPTIONS before some cross-origin requests. Your server must respond 200/204 with matching allow headers.

Credential rule

If Allow-Credentials: true, you cannot use wildcard * for Allow-Origin.

Frontend fetch example

fetch(url, {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify(payload)
})

Debug checklist

  • Check actual origin in DevTools.
  • Ensure reverse proxy passes OPTIONS.
  • Do not set CORS only on success responses.