Guide

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.

Input & settings#289

Ready. Processing stays in this browser.

ResultAwaiting input

No cross-origin network probe is performed. A successful simulation does not verify your server.

Essential CORS Response Headers

HeaderPurposeCommon Pitfall
Access-Control-Allow-OriginSpecifies the allowed origin or *Cannot list multiple comma-separated origins
Access-Control-Allow-CredentialsAllows cookies and auth headersInvalid when paired with * origin
Access-Control-Allow-HeadersPermits non-simple request headersAuthorization must be listed explicitly
Access-Control-Expose-HeadersExposes custom response headers to JSHidden 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.