Member-only story
CORS Preflight Request
Ever wonder what a preflight request is ???? Let’s get deeper into this today !!
What Is a Preflight Request?
A preflight request is an HTTP OPTIONS request sent before the actual request. Its purpose is to ask the server whether the actual request is safe to send.
It is called “preflight” because it’s like checking the conditions before “taking off” with the actual HTTP request.
Why Is It Needed?
Before going into details, of why its needed, lets understand what is origin.
Definition of “Origin”
An origin is defined by three components:
Origin = Protocol + Host + Port
Example :
- Even a different subdomain, protocol, or port means a different origin.
Now, the browsers enforce a same-origin policy for security reasons. Just for understanding better, the Same-Origin Policy (SOP) is a security feature implemented by web browsers to restrict how documents or scripts loaded from one origin can interact with resources from another origin.










