Stop Copy-Pasting Headers and Start Understanding Cross-Origin Resource Sharing.
Read the book online at cloudstreet-dev.github.io/Understanding-CORS.
This book covers CORS from first principles through production configuration and security. It's structured in five parts:
- The Problem CORS Solves — The Same-Origin Policy, why browsers enforce it, and what an "origin" actually is.
- How CORS Actually Works — Simple requests, preflights, every header explained, credentials, and caching.
- CORS in the Wild — Fetch/XHR, WebSockets, fonts, SPAs, API gateways, and proxies.
- Server-Side Configuration — Express, Go, Rust, Python, Nginx, Apache, serverless, and edge functions.
- Debugging and Security — Reading error messages, common mistakes, security boundaries, and when
*is fine.
Install mdBook, then:
mdbook serve --openThanks to Georgiy Treyvus, CloudStreet Product Manager, for the idea for this book.
This work is dedicated to the public domain under CC0 1.0 Universal.