CORS
Cross-Origin Resource Sharing (CORS) is a web standard that uses HTTP headers to let servers specify which origins may access their resources through browsers.
ASP.NET Core in Action, 3e
Cross-origin resource sharing is a browser and server mechanism that controls whether a web application may make requests across origins and which parts of those requests and responses are permitted.
- How it is used
- Enables browser JavaScript to access an API at another origin under an explicit policy.
- How deep it goes
- Explains origins, response headers, preflight, and policy configuration while leaving detailed specification mechanics to the framework.
- Examples
- Uses a shopping site and product API to demonstrate a named origin policy and global middleware configuration.
- What you can do after
- Operate/configure CORS using ASP.NET Core policies, middleware, and endpoint metadata.
Building Web APIs with ASP.NET Core
Cross-Origin Resource Sharing (CORS) is a browser security mechanism that controls whether web clients may request resources from a different origin.
- How it is used
- Enables browser scripts at another origin to request API resources under server-defined rules.
- How deep it goes
- Defines the browser restriction and walks through ASP.NET Core policies, middleware, and endpoint assignment without examining browser internals.
- Examples
- Uses default and named policy listings, endpoint configuration, and a GET-only Minimal API exercise.
- What you can do after
- Operate/configure it in ASP.NET Core by registering policies, enabling middleware, and assigning endpoint-specific rules.
Read how Building Web APIs with ASP.NET Core explains CORS →
Spring Security in Action, Second Edition
Cross-origin resource sharing is a browser security mechanism that controls whether a web page may access resources from another origin.
- How it is used
- Explains how browser-based frontends access backend resources hosted on different origins.
- How deep it goes
- Covers browser rejection, HTTP headers, preflight requests, and endpoint or centralized Spring configuration.
- Examples
- Uses example.com, example.org, localhost:8080, an iframe, XMLHttpRequest, and a /test endpoint returning HELLO.
- What you can do after
- Configure endpoint-specific or centralized CORS rules and test browser acceptance of cross-origin responses.
Read how Spring Security in Action, Second Edition explains CORS →
Acing the Frontend Interview
Cross-Origin Resource Sharing is a browser and HTTP mechanism that controls whether a web origin may access resources from another origin.
- How it is used
- Handles browser access between separately deployed frontend and backend tiers in distributed web architectures.
- How deep it goes
- Explains same-origin policy, response headers, credentials, preflight handling, curl verification, and a development proxy.
- Examples
- Uses an Express middleware configuration, an OPTIONS curl response, and a React + Vite proxied dog-image request.
- What you can do after
- Configure CORS headers, handle preflight requests, verify responses, and apply a React + Vite API proxy.
Build Financial Software with Generative AI (From Scratch)
Cross-Origin Resource Sharing (CORS) is a browser security mechanism that controls whether a web page may request resources from a different origin.
- How it is used
- Controls browser access to a local API from a separately served web page and dashboard.
- How deep it goes
- Explains response headers and middleware settings, with basic troubleshooting and a note on preflight OPTIONS behavior.
- Examples
- Uses a localhost health-check request and a dashboard configuration with GET and POST.
- What you can do after
- Operate/configure FastAPI CORS middleware for expected origins and methods, and diagnose common local request errors.
Read how Build Financial Software with Generative AI (From Scratch) explains CORS →
Spring in Action, Sixth Edition
CORS is a web security mechanism that allows a server to declare which origins may access its resources from browser-based clients.
- How it is used
- Enables a separate JavaScript client to consume a Spring REST API from an approved host or port.
- How deep it goes
- Explains the browser restriction and demonstrates annotation-based origin configuration, but does not detail CORS protocol exchanges.
- Examples
- Demonstrates @CrossOrigin on TacoController with one or multiple allowed origins.
- What you can do after
- Apply CORS via Spring's @CrossOrigin annotation to permit named browser client origins.
Vanilla Web
Cross-origin resource sharing is a web mechanism through which servers use HTTP headers to specify which other origins may access their resources.
- How it is used
- Enables controlled access to APIs and assets from other origins while retaining the browser’s default same-origin isolation.
- How deep it goes
- Defines the server-header requirement and explains credentialed fetch behavior, without a step-by-step server configuration.
- Examples
- Contrasts same-origin and cross-origin account fetches, and identifies a cross-origin module request blocked without CORS headers.
- What you can do after
- Operate/configure it by setting server response headers and selecting an appropriate fetch credentials mode for cross-origin requests.
Rust Web Development
Cross-Origin Resource Sharing (CORS) is a browser security mechanism that controls whether web pages may access resources from a different origin.
- How it is used
- Enables browser clients on other domains to access an API by returning allowed origins, methods, and headers.
- How deep it goes
- Explains preflight requests, exceptions, Warp configuration, and rejection handling without serving as an exhaustive reference.
- Examples
- Tests a localhost /questions OPTIONS request with PUT, content-type, and Origin headers, including allowed and rejected responses.
- What you can do after
- Apply CORS via Warp by configuring allowed origins, methods, and headers; diagnose rejected headers with curl and return a 403 error.
Also covered in
- Building User-Friendly DSLs
- Grokking Web Application Security
- Pro Angular 16
- AI Agents in Action, Second Edition
- Build AI-Enhanced Web Apps
- Quarkus in Action
- Pro ASP.NET Core 7, Tenth Edition
- Enterprise RAGIn early access (MEAP)
What to know first
- HTTPHTTP is an application-layer protocol that defines request-and-response communication for transferring resource representations and related metadata between networked systems.
- cookieAn HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences.
- cross-origin requestA cross-origin request is a network request from a webpage or script to a resource whose origin differs from the requester’s origin.
Related concepts
- @crossoriginconfigured by · @CrossOrigin is a Spring annotation that enables and configures cross-origin resource sharing for a controller or request handler.
- same-origin policyaddresses · The same-origin policy is a browser security mechanism that restricts how scripts and documents interact with resources from origins that differ in scheme, host, or port.
- cross-origin requestconfigures · A cross-origin request is a network request from a webpage or script to a resource whose origin differs from the requester’s origin.
- HTTP headeruses · An HTTP header is a named field in an HTTP message that carries metadata or control information about the message, its content, or its processing.
- ASP.NET Coreuses · ASP.NET Core is Microsoft's open-source, cross-platform framework for building web applications and services on .NET.
Questions about CORS
What is CORS?
Cross-Origin Resource Sharing (CORS) is a web standard that uses HTTP headers to let servers specify which origins may access their resources through browsers.
Which Manning books explain CORS?
ASP.NET Core in Action, 3e, Building Web APIs with ASP.NET Core, Spring Security in Action, Second Edition, Acing the Frontend Interview, Build Financial Software with Generative AI (From Scratch), Spring in Action, Sixth Edition, Vanilla Web and Rust Web Development.
What should I know before learning CORS?
Manning books that teach CORS usually introduce HTTP, cookie, cross-origin request and OPTIONS first.
What is CORS also called?
CORS is also called cross-origin resource sharing.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.







