preflight request

An automatic OPTIONS request a browser sends before a cross-origin request that is not simple, to ask the server for permission first.

In more detail

It names the origin, the intended method in Access-Control-Request-Method, and any extra headers. The server answers with the methods and headers it allows and how long the browser may remember the decision, and with Vary: Origin so caches keep answers per origin.

Example

In the browser: It is triggered by non-simple requests, such as methods like PUT or DELETE, custom headers, or a JSON content type. The server answers with Access-Control-Allow-Methods and Access-Control-Allow-Headers, and only then does the browser send the real request.

Related terms

Taught in

References