Generated by GPT-5-mini| cors (software) | |
|---|---|
| Name | cors (software) |
cors (software) is a server-side mechanism and set of protocols that govern cross-origin HTTP requests between web origins, browsers, and servers. It specifies how user agents such as Mozilla Firefox, Google Chrome, Microsoft Edge, Safari, and Opera handle requests across different origins and how servers such as Apache HTTP Server, NGINX, IIS (Internet Information Services), and Lighttpd advertise permissions. The specification intersects with standards and organizations including World Wide Web Consortium, WHATWG, Internet Engineering Task Force, ECMAScript, and WebAssembly.
cors coordinates interactions among client-side platforms like React (web framework), Angular (web framework), Vue.js, jQuery, and server-side runtimes such as Node.js, Deno, Ruby on Rails, Django, Flask (web framework), and ASP.NET Core. It uses HTTP headers to permit or deny access, relying on header fields standardized in proposals associated with Tim Berners-Lee, Brendan Eich, Vint Cerf, Roy Fielding, and technical committees in W3C Technical Architecture Group. Browsers implement policies influenced by documents from ECMA International and drafts discussed at IETF working group meetings. cors affects integrations with services like Amazon Web Services, Google Cloud Platform, Microsoft Azure, Heroku, and Cloudflare.
The mechanism evolved from ad hoc techniques such as JSONP used by projects like Facebook (company), Twitter, and Flickr to overcome same-origin restrictions enforced since early implementations of Netscape Navigator and Internet Explorer. Specification work advanced through contributions by engineers at Mozilla Foundation, Google, Apple Inc., and Microsoft. Influential documents from W3C, community discourse on GitHub, and RFC-style discussions at IETF shaped the headers and preflight behaviors. Major browser releases — for example, Firefox 3.6, Chrome 3, and Safari 4 — incrementally changed enforcement, while frameworks such as Apache Cordova and platforms like Firebase adapted server-side guidance.
cors relies on a set of HTTP header components: request headers like Origin (HTTP header), Access-Control-Request-Method, Access-Control-Request-Headers; response headers such as Access-Control-Allow-Origin, Access-Control-Allow-Methods, Access-Control-Allow-Headers, Access-Control-Allow-Credentials, Access-Control-Max-Age; and status codes defined in Hypertext Transfer Protocol (HTTP/1.1). The preflight handshake uses an OPTIONS request pattern similar to mechanisms discussed in RFC 7231 and is mediated by user agents including Brave (web browser). Servers express policies in configuration files for servers like NGINX and modules such as mod_headers on Apache HTTP Server. Application middleware offerings include packages from ecosystems such as npm (software), RubyGems, PyPI, and NuGet Package Manager.
Administrators configure cors via directives in NGINX configuration, Apache HTTP Server .htaccess, or middleware in Express (web framework), Koa (web framework), Spring Framework, Laravel, Symfony (software), Gin (web framework), and ASP.NET Core. Cloud services like Amazon S3, Google Cloud Storage, and Azure Blob Storage expose cors settings in management consoles and SDKs. Developers map the origin negotiation to identity providers such as OAuth 2.0, OpenID Connect, SAML, and services like Auth0 and Okta. Testing and debugging tools include Postman (software), curl, Fiddler, Wireshark, and browser developer tools shipped with Chromium and WebKit-based projects.
cors intersects with web security practices promoted by organizations such as Open Web Application Security Project, Cybersecurity and Infrastructure Security Agency, and standards like Transport Layer Security and HTTP Strict Transport Security. Misconfigured headers can enable cross-site request forgery vectors discussed in literature involving OWASP Top Ten and incidents affecting services such as GitHub or Stripe. Allowing credentials via Access-Control-Allow-Credentials requires careful trust models tied to origins often tied to domains registered through Internet Corporation for Assigned Names and Numbers. Secure deployments pair cors with controls like Content Security Policy, Subresource Integrity, SameSite cookie attribute, and backend checks referencing identity providers like Keycloak.
Popular server-side implementations include modules and middleware for Node.js (express-cors packages), adapters for Apache Tomcat, Jetty, WildFly, and plugins for NGINX Unit. Integrations extend to platforms such as GraphQL, gRPC-Web, WebSocket protocol, Server-Sent Events, and edge platforms like Fastly and Akamai Technologies. Large projects and companies — for example, Facebook, Google LLC, Amazon.com, Inc., Twitter, Inc. — implement cors policies at CDN edges and API gateways such as Kong, NGINX Plus, Istio, and Envoy.
cors introduces additional round-trips for preflighted requests, impacting latency comparable to behaviors documented for HTTP/2 and mitigations discussed within QUIC and HTTP/3 contexts. Caching via Access-Control-Max-Age reduces repeated OPTIONS costs, but intermediaries such as Content Delivery Network nodes and proxies like Squid (software) can complicate semantics. Limitations stem from browser enforcement differences across WebKit, Blink (layout engine), Gecko and server misconfigurations encountered in ecosystems like Java EE, .NET Framework, and PHP. Performance tuning aligns with recommendations from Google Web Fundamentals, Mozilla Developer Network, and enterprise guidelines from Gartner.
Category:Web technology