Skip to content
Commitwise
Menu

Same-origin policy

The browser rule that a page may send requests to other origins but may not read their responses unless allowed.

Definition

An origin is scheme, host and port. Without this rule any website could read your bank's API with your cookies. Servers relax it for chosen origins with CORS headers. It applies only in browsers; native apps and servers are not restricted, and WebSockets are not covered, so their servers must check the Origin header.

In practice

https://shop.example can't read a response from https://api.shop.example unless the API allows that origin.

Related terms

Esc

Type to search the whole site.