Category: Forms and APIs

CORS: preflight OPTIONS ends 403 before sending POST

Read this guide in Polish

The form from the browser does not send POST, because first the OPTIONS request is blocked. CORS requires a correct preflight response for origin, method and headers used in the request.

How to determine the source of the error

In DevTools, find OPTIONS and its status, not just a JavaScript message.

Check Access-Control-Allow-Origin, -Methods and -Headers in the server response for a particular origin.

What to do step by step

1. Add OPTIONS support to endpoint and limited allowlist of permitted domains and headers.

2 . If endpoint requires cookies, configure credentials and origin openly, without wildcard at credentialed requests.

How to check the score

The browser sends POST after successful preflight, and the unauthorized domain still has no CORS approval.

What to do

Do not try to fix the server by mode: no-cors — hide the answer from the application.