CORS Headers Reference
Reference table for common CORS request and response headers used to control cross-origin browser requests.
| Header | Type | Purpose | Example |
|---|---|---|---|
Access-Control-Allow-Origin |
Response | Specifies which origin is allowed to access the resource. | Access-Control-Allow-Origin: https://example.com |
Access-Control-Allow-Methods |
Response | Lists HTTP methods allowed for cross-origin requests. | Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS |
Access-Control-Allow-Headers |
Response | Lists request headers the browser is allowed to send. | Access-Control-Allow-Headers: Content-Type, Authorization |
Access-Control-Allow-Credentials |
Response | Allows cookies, authorization headers, or TLS client certificates to be included. | Access-Control-Allow-Credentials: true |
Access-Control-Expose-Headers |
Response | Lets browser JavaScript read specific response headers. | Access-Control-Expose-Headers: X-Request-ID, X-RateLimit-Remaining |
Access-Control-Max-Age |
Response | Tells the browser how long to cache the preflight response. | Access-Control-Max-Age: 86400 |
Origin |
Request | Sent by the browser to indicate the source origin of the request. | Origin: https://example.com |
Access-Control-Request-Method |
Request | Used in a preflight request to indicate the actual request method. | Access-Control-Request-Method: POST |
Access-Control-Request-Headers |
Request | Used in a preflight request to indicate which custom headers will be sent. | Access-Control-Request-Headers: Content-Type, Authorization |
Vary |
Response | Important when dynamically returning CORS headers, especially by Origin. | Vary: Origin |