CORS Policy Builder

Build correct Cross-Origin Resource Sharing configuration without trial and error, including the origin allowlist pattern and Vary: Origin.

Use the tool

Why this tool exists

List the allowed origins (or *), methods, request headers, exposed headers, credentials and preflight cache time, then pick a target. The tool refuses the invalid combination of * with credentials, validates that each origin is scheme plus host, and produces config that echoes the request Origin only when it is on the list and adds Vary: Origin so caches stay correct.

CORS controls whether browsers let a page read a response; it is not authentication and does not stop other clients calling your API. Browsers cap Access-Control-Max-Age (Chrome 2 hours, Firefox 24 hours).

No data is sent anywhere: the work happens in your browser, so you can use it offline once the page has loaded.

How to use it

  1. List allowed origins, one per line (or *).
  2. Set methods, headers, credentials and max-age.
  3. Choose your server and copy the config.
  4. Test with a preflight request from the browser console or the CORS inspector.

Frequently asked questions

Can I use * with cookies?

No. Browsers reject Access-Control-Allow-Origin: * on credentialed requests; list explicit origins.

Why Vary: Origin?

So a cache does not serve a response with one origin's CORS headers to a different origin.

Does CORS protect my API?

No. It only restricts browser scripts. Use authentication and authorisation for protection.

Is my data sent anywhere?

No. Everything is processed in your browser, and the page makes no network requests with your input.