CORS Header Builder

Configure allowed origins, methods, headers, and credentials, then get the exact Access-Control-* headers plus server config snippets to copy and paste.

CORS Policy Configuration

One origin per line. Use * for all origins (incompatible with credentials).

Allowed Methods

Headers the browser is allowed to read from the response.

Allows cookies and HTTP authentication. Cannot be used with wildcard origin.

How long browsers may cache the preflight result. 86400 = 24 hours.

Raw HTTP Response Headers
Generate headers to see output...
nginx Configuration
Generate headers to see output...
Apache (.htaccess)
Generate headers to see output...
Express.js / Node.js
Generate headers to see output...
Copied!

Summary

Configure allowed origins, methods, headers, and credentials, then get the exact Access-Control-* headers plus server config snippets to copy and paste.

How it works

  1. Fill in the allowed origins, select HTTP methods, specify allowed and exposed headers, set credentials and cache duration. The tool generates the correct Access-Control-* response headers and wraps them in server-specific config blocks you can paste directly into your configuration.

Use cases

  • Configure CORS for a REST API served from a different domain than the frontend.
  • Set up preflight response headers for browsers making credentialed cross-origin requests.
  • Generate production nginx location blocks or Apache .htaccess CORS directives.
  • Debug a CORS policy by inspecting exactly which headers will be emitted.
  • Lock down an API to specific origins before deploying to production.

Frequently Asked Questions

Last updated: 2026-06-09 · Reviewed by Nham Vu