Generated by GPT-5-mini| Cross-Origin Resource Sharing | |
|---|---|
| Name | Cross-Origin Resource Sharing |
| Caption | CORS flow between Tim Berners-Lee-style client and Roy Fielding-inspired servers |
| Introduced | 2004 |
| Standard | World Wide Web Consortium |
| Related | XMLHttpRequest, Fetch API, Same-Origin Policy |
Cross-Origin Resource Sharing Cross-Origin Resource Sharing is a web mechanism that enables controlled access to resources located outside a given Origin by defining HTTP headers and negotiation patterns. It evolved as a complement to the Same-Origin Policy enforced by browsers like Netscape and modern vendors such as Google, Mozilla Foundation, and Microsoft Corporation, facilitating interoperable interactions among services exemplified by Amazon, Facebook, Twitter, and GitHub.
CORS addresses limitations imposed by the Same-Origin Policy introduced in early implementations by Netscape and standardized through community efforts involving entities like the World Wide Web Consortium, Internet Engineering Task Force, and contributors including Roy Fielding and Tim Berners-Lee. Web applications hosted on domains such as example.com, mozilla.org, google.com, and facebook.com require safe cross-origin requests to interact with APIs provided by organizations like Twitter, Inc., GitHub, Inc., Stripe, Inc., and PayPal Holdings, Inc.. CORS uses a declarative model where servers controlled by companies like Amazon Web Services, Cloudflare, or institutions such as MIT and Stanford University signal permission through headers consumed by browsers like Google Chrome, Mozilla Firefox, Microsoft Edge, and Apple Safari.
The architecture builds on HTTP semantics defined by standards bodies including the Internet Engineering Task Force and the World Wide Web Consortium. Core actors include browser clients (e.g., Google Chrome, Mozilla Firefox), origin servers (e.g., hosted on Amazon EC2, Google Cloud Platform, Microsoft Azure), and intermediary caches such as Akamai Technologies and Cloudflare. Key headers like Access-Control-Allow-Origin, Access-Control-Allow-Methods, and Access-Control-Allow-Headers map to HTTP flows rooted in RFCs authored by contributors affiliated with organizations like Mozilla Foundation and Microsoft Corporation. Implementations often intersect with APIs standardized by projects such as WHATWG and APIs used by platforms like Facebook Platform, Twitter API, Google APIs, and Stripe API.
CORS differentiates "simple" requests from those requiring a preflight OPTIONS request, an approach influenced by HTTP negotiation methods used in Hypertext Transfer Protocol work led by engineers including Tim Berners-Lee and researchers at W3C. Preflight flows involve the browser issuing an OPTIONS request to origins hosted on infrastructure providers like Heroku, Netlify, or repositories on GitHub before sending methods such as PUT or DELETE to services run by organizations like Dropbox, Inc. or Box, Inc.. Servers operated by enterprises such as Salesforce, Oracle Corporation, and SAP SE must respond with appropriate Access-Control headers to allow clients built with frameworks from React, Angular, Vue.js, or libraries like jQuery to proceed.
Security analysis draws on threat modeling practices used by institutions such as MIT, Stanford University, and security teams at Google and Microsoft. CORS mitigates risks of cross-origin information leaks but requires careful configuration to avoid enabling overbroad origins that attackers affiliated with adversarial actors could exploit. Misconfigurations can affect services like Stripe, PayPal, Auth0, and identity providers including Okta and OneLogin, impacting authentication flows standardized by bodies such as OpenID Foundation and OAuth 2.0 working groups. Security researchers from OWASP, SANS Institute, and companies like CrowdStrike and FireEye publish advisories relevant to header misuse, credential leakage, and framing attacks associated with integrations with platforms such as Salesforce and Slack Technologies.
Browser vendors Google, Mozilla Foundation, Apple Inc., and Microsoft Corporation implement CORS logic in engines like Blink, Gecko, WebKit, and EdgeHTML (legacy), following specifications discussed at W3C and WHATWG. Server-side frameworks and servers including Apache HTTP Server, Nginx, IIS, Node.js, Django, Ruby on Rails, Spring Framework, and Express provide middleware or module support to set CORS headers. CDNs from Cloudflare, Akamai Technologies, and Fastly often include configuration panels used by companies like Netflix, Spotify, and Airbnb to manage cross-origin access for assets and APIs.
Common scenarios include single-page applications on domains like netlify.com, vercel.com, or github.io calling APIs hosted by Amazon Web Services, Google Cloud Platform, or Microsoft Azure. Integration examples involve third-party widgets from Facebook, Twitter, and YouTube embedded in sites run by news organizations such as The New York Times or BBC and ecommerce platforms like Shopify and Magento. Developers working with APIs from Stripe, PayPal, Google Maps Platform, and Mapbox must coordinate CORS headers, while mashups combining data from repositories on GitHub and registries like npm or Maven Central demonstrate practical usage.
CORS is constrained by browser enforcement models designed by vendors including Google and Apple, which leads some architects to adopt alternatives like JSONP used historically by services such as Flickr and Twitter or server-side proxies deployed on platforms like Heroku and AWS Lambda. Other approaches include using standardized cross-origin resource techniques via OAuth 2.0 for delegated access, edge-side include strategies employed by CDNs like Akamai Technologies and Cloudflare, or moving logic to backend microservices orchestrated with tools from Kubernetes and Docker. Architectural patterns popularized by companies such as Netflix and Amazon influence decisions to avoid client-side cross-origin calls in favor of controlled server-to-server communication.
Category:Web technology