Web Security • HTTP & APIs
CORS Header Generator & Preflight Debugger
Simulate browser CORS preflight checks, catch wildcard-plus-credentials bugs, and export ready-to-use CORS configs for HTTP, Next.js, Express, Nginx, and Cloudflare Workers.
Simulate browser preflight decisions and generate response headers for manual server configuration.
Ready. Processing stays in this browser.
No cross-origin network probe is performed. A successful simulation does not verify your server.
Essential CORS Response Headers
| Header | Purpose | Common Pitfall |
|---|---|---|
Access-Control-Allow-Origin | Specifies the allowed origin or * | Cannot list multiple comma-separated origins |
Access-Control-Allow-Credentials | Allows cookies and auth headers | Invalid when paired with * origin |
Access-Control-Allow-Headers | Permits non-simple request headers | Authorization must be listed explicitly |
Access-Control-Expose-Headers | Exposes custom response headers to JS | Hidden from fetch() unless declared |
Related Security & Developer Tools
Frequently Asked Questions
Why does Access-Control-Allow-Origin: * fail when credentials are enabled?
Per the Fetch specification, browsers reject responses that combine Access-Control-Allow-Origin: * with Access-Control-Allow-Credentials: true. To send cookies or Authorization headers cross-origin, your server must return the exact requesting Origin and include Vary: Origin.
What triggers a CORS OPTIONS preflight request?
Any request using methods outside GET, HEAD, or POST (such as PUT, PATCH, or DELETE), sending custom headers like Authorization or X-API-Key, or using a Content-Type other than text/plain, application/x-www-form-urlencoded, or multipart/form-data (such as application/json) triggers an OPTIONS preflight.
What does Access-Control-Max-Age do?
Access-Control-Max-Age tells the browser how many seconds to cache the preflight OPTIONS response. Setting it to 86400 (24 hours) reduces redundant OPTIONS round-trips, though browsers enforce their own maximum caps (e.g., 2 hours in Chromium).
Why should I include Vary: Origin when echoing dynamic origins?
If your API dynamically allows multiple origins, CDNs and intermediate proxies could cache a response for Origin A and serve it to Origin B unless Vary: Origin is set.