CORS Preflight Failed Fix

CORS preflight failures happen before your frontend receives a normal response. Debug the OPTIONS request and response headers first.

Symptoms

  • Browser console mentions CORS policy or preflight request failed.
  • The OPTIONS request fails or lacks allow headers.
  • curl works but browser fetch fails.

Likely causes

  • Server does not handle OPTIONS requests.
  • Access-Control-Allow-Origin, Methods or Headers are missing.
  • Credentials are enabled with a wildcard origin.

Fix steps

  1. Inspect the OPTIONS request in DevTools Network.
  2. Return the correct Access-Control-Allow-* headers from the API or proxy.
  3. Avoid wildcard origin when credentials are required.

Verify the fix

  • Reload with cache disabled.
  • Test the browser request again, not only curl.
  • Check CDN or reverse proxy rules if headers vanish.

FAQ

Can frontend JavaScript fix CORS?

No. The responding server or proxy must send the correct CORS headers.

Why does curl work?

curl does not enforce browser CORS rules.

Related tools and guides

Last updated: May 18, 2026