Home/Guides/CORS preflight failed fix for browser API calls

CORS preflight failed fix for browser API calls

Browsers send OPTIONS before non-simple requests. Preflight fails when Allow-Origin, Allow-Methods, or Allow-Headers do not match what the app sends. API keys in custom headers always trigger preflight.

Common causes

  • OPTIONS returns 404 or 401.
  • Credentials without Access-Control-Allow-Credentials.
  • Wildcard origin with credentials.

How to fix

  • Fix server OPTIONS handler and headers.
  • Use CORS Checker against the real URL.
  • Align allowed headers with client fetch options.

Use our tool

Test CORS