CORS Header Generator
Generate CORS headers configuration.Runs in this tab.⌘ ↵ runs it
Next step
AtriumKitFrom the team behind browserutils
Turn a click-through into an interactive demo
AtriumKit records your web app once in Chrome and turns every click into a step of a demo you can embed or share. There’s a free plan.
Try AtriumKit freeAbout CORS Header Generator
Free online CORS header generator. Generate Access-Control-Allow-Origin and other CORS headers for your API. Get configuration for Express, Nginx, Apache, and more. It runs in your browser. Nothing is sent to a server.
Questions
What is CORS?
CORS (Cross-Origin Resource Sharing) is a security mechanism that allows web applications on one domain to request resources from another domain. It uses HTTP headers to tell browsers which cross-origin requests should be permitted.
What is the Access-Control-Allow-Origin header?
The Access-Control-Allow-Origin header specifies which origins are allowed to access the resource. It can be set to a specific origin (e.g., https://example.com), or * to allow any origin (not recommended for credentialed requests).
What is a CORS preflight request?
A preflight request is an OPTIONS request the browser sends automatically before certain cross-origin requests (like those with custom headers or non-simple methods). The server must respond with the appropriate CORS headers to allow the actual request to proceed.
What server configurations does the CORS generator output?
The generator produces CORS header configurations for Express.js, Nginx, Apache (.htaccess), and raw HTTP headers, so you can copy the snippet directly into your server setup.
Is it safe to set Access-Control-Allow-Origin to *?
Using * allows any website to make requests to your API, which is fine for public APIs. For APIs that use cookies or authentication tokens, you must specify exact origins instead of * to prevent security risks.
Comments
More in Web & Networking
- URL Parser
- HTTP Status Codes Reference
- HTTP Headers Reference
- MIME Types Reference
- HTTP Methods Reference
- IP Address Converter
- CIDR Calculator
- DNS Record Types Reference
Comments