DELAPARRA
Index
Color
NL
Category: HTTP headers

Access-Control-Allow-Origin

Explained by Updated

What is Access-Control-Allow-Origin?

Access-Control-Allow-Origin: Server's answer to cross-origin requests: which origins may read this response. The most-asked-about HTTP header on Stack Overflow. Access-Control-Allow-Origin decides which websites may read a response from your server in the browser. It is the core of CORS, and the header behind countless error messages on Stack Overflow. Browsers block JavaScript on one origin from reading responses from another, unless the server explicitly allows it. The value is either one origin, such as https://app.example.com, or * for any origin.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Access-Control-Allow-Origin

What should you keep in mind with Access-Control-Allow-Origin?

Use * only for truly public data without cookies, such as a public JSON feed. For anything tied to a user, list the exact origins you trust. Remember that CORS protects users in browsers, not your server. Anyone can still call your API directly with curl. Authentication and permission checks remain your real security; CORS only decides which websites may use a visitor's browser to read the result.

What does an example of Access-Control-Allow-Origin look like?

Access-Control-Allow-Origin: https://app.example.com

At a glance

CategoryHTTP headers
Explained by
Updated

More HTTP headers terms

All terms starting with A

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.