send.webforms.toRead the docs →

What Is a CORS Preflight Request?

A CORS preflight is an OPTIONS request a browser sends before certain cross-origin requests, asking the destination whether the real request is allowed. Only if the response permits the method and headers does the browser send the actual request.

The confusing part is that plain HTML form posts never trigger one. A form submitted normally is a simple request, so it goes straight through, which is why a form can post to another domain while a fetch to the same URL fails with a CORS error.

What pushes a request out of simple territory is usually a header you added. Content-Type: application/json is the common one. So is a custom header such as X-Requested-With. Remove them and the preflight disappears.

When you do see a CORS failure, read it precisely. The browser blocked the response, which means the request often reached the server and did something. A submission that appears to fail in the console may already be stored.

More terms