Same-origin policy


CORS in 100 Seconds

CORS (Cross-Origin Resource Sharing) is a security feature in web browsers that controls access to resources across different domains. It ensures that only trusted domains can access resources, preventing unauthorized access and protecting user data and actions. It extends and adds flexibility to the same-origin policy (SOP). However, it also provides potential for cross-domain attacks, if a website's CORS policy is poorly configured and implemented. CORS is not a protection against cross-origin attacks such as cross-site request forgery (CSRF).

Sec-Fetch

Sec-Fetch-* headers are sent by the browser in cross-origin requests. Their purpose is to indicate the relationship between a request initiator’s origin and the origin of the requested resource.

The malicious CSRF request is sent with the following headers by the browser:

Sec-Fetch-Dest: empty

Sec-Fetch-Site: cross-site

Sec-Fetch-Mode: cors


Simple HTTP requests are the requests that we can trigger using just HTML. Anything other than that is considered as a PreFlighted Request.

Simple HTTP Request

Preflighted Request


Coming Back to COOKIES