Skip to content

CORS Header Generator

Embed

Paste this where you want CORS Header Generator on your site. Adjust the height to fit.

<iframe src="https://www.browserutils.dev/embed/cors-header-generator/" width="100%" height="500" frameborder="0" loading="lazy" title="CORS Header Generator"></iframe>
<p style="font-size:12px;margin:4px 0 0"><a href="https://www.browserutils.dev/tools/cors-header-generator/">CORS Header Generator</a> by BrowserUtils</p>

Generate CORS headers configuration.Runs in this tab.

Next step

About 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.

More in Web & Networking

All 23 web & networking