CORS Policy Builder

Configure cross-origin response headers and server snippets entirely in your browser

CORS configuration

Choose which origins, methods, and headers your server should allow.

Enter one origin per line.

Permit cookies and authorization credentials.

Generated policy

Copy the format that matches your application or server.

Access-Control-Allow-Origin: https://example.com
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Expose-Headers: 
Access-Control-Allow-Credentials: false
Access-Control-Max-Age: 86400

Privacy: your policy is generated locally. No origins, headers, or configuration data leave your browser.

About this tool

CORS (Cross-Origin Resource Sharing) is the browser security protocol that decides whether code running on one origin may read a response from another. A working policy coordinates the allowed origin, methods, request headers, exposed response headers, credentials, and preflight cache duration; a mismatch in any one of them can block a valid frontend or expose an API more broadly than intended.

CORS Policy Builder turns those choices into three practical outputs: raw Access-Control response headers, Nginx add_header directives, and a JavaScript fetch example. Multiple origins require dynamic server logic because Access-Control-Allow-Origin accepts only one origin or a wildcard. For credentialed requests, the server must validate the incoming Origin against an allowlist before echoing it and cannot return *.

Generation is fully client-side, so origin allowlists and API header names never leave your browser. The output is a configuration aid: apply it to the route that handles both the actual request and its OPTIONS preflight, then verify the response in browser developer tools.

How to use

  1. Set origins and methods

    Enter one allowed origin per line and toggle the HTTP methods your cross-origin clients may use.

  2. Configure header access

    List the request headers accepted by your server and the response headers browser code may read.

  3. Choose credentials and caching

    Enable credentials only for trusted explicit origins, then set how long browsers may cache a successful preflight.

  4. Copy the policy

    Use the Headers, Nginx, or fetch example tab and copy the generated format you need.

Generated CORS formats

FormatUse
HeadersRaw Access-Control response-header lines for documentation or middleware
Nginxadd_header directives for an Nginx server or location block
fetch exampleBrowser request snippet using mode: cors and the chosen credential behavior

Generated locally — no origin or API configuration is uploaded.

Frequently asked questions