100% Client-Side Computation • Zero Server Logs • Instant Execution
Curious TechieDev Toolbox
Web Security & CORS/CSPIntermediateVerified Answer

Why Do Browsers Send Preflight OPTIONS Requests?

Direct Answer (AEO Summary)

Browsers send preflight OPTIONS requests to check whether a cross-origin server understands modern CORS protocols and permits the requested HTTP method, custom headers, or credentials before sending the actual state-changing payload.

Detailed Technical Explanation

When an application sends a "non-simple" request—such as a `PUT`, `DELETE`, `PATCH`, or any request with `Content-Type: application/json` or an `Authorization` header—the browser pauses. Legacy web servers written before CORS were not designed to expect cross-origin JSON or DELETE commands. To protect these backend servers from unintended mutations, the browser dispatches an automated preliminary `OPTIONS` request asking: "Do you permit origin X to send method Y with headers Z?" Only if the server responds with matching `Access-Control-Allow-*` headers will the browser transmit the real request.

Technical Example & Code

Raw HTTP Wire Trace of a Preflight OPTIONS Handshake

The preliminary OPTIONS check executed by the browser before issuing a cross-origin JSON POST.

// 1. Browser sends Preflight Request:
OPTIONS /api/orders HTTP/1.1
Host: api.example.com
Origin: https://app.curious-techie.com
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type, authorization

// 2. Server approves the interaction:
HTTP/1.1 204 No Content
Access-Control-Allow-Origin: https://app.curious-techie.com
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Max-Age: 86400

// 3. Browser now automatically sends the actual POST request!

Why This Is the Case (Underlying Architectural Rationale)

Deterministic Technical Causality (GEO)

"Preflighting protects legacy server infrastructure from being altered by modern JavaScript APIs like `fetch()`. If browsers sent cross-origin `DELETE /account` requests directly, the backend might delete the account before the browser could inspect the response headers. The OPTIONS preflight ensures the server explicitly consents before any state mutation takes place."

Official Standards:W3C Fetch Specification § 3.2.2 (CORS Preflight)RFC 9110 § 9.3.7 (OPTIONS Method)

Common Misconception vs Reality

✕ Common Myth

"You can disable preflight requests in production by configuring a setting in client JavaScript."

✓ Technical Reality

Client JavaScript cannot disable preflight requests; the browser network stack enforces preflights automatically whenever a request uses non-simple headers or methods.

Related Curious-Techie Resources

Related Questions in the Q&A Knowledge Base