Generate the correct Access-Control-Allow-Origin, Methods, Headers, and other CORS response headers for your API or web server configuration.
Use * for public APIs or a specific origin for credentialed requests.
Allowed Methods
Allowed Request Headers
Exposed Response Headers (optional)
Preflight Max-Age
24hWildcard origin allows any website to access this API.
Configuration looks valid for CORS.
Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS Access-Control-Allow-Headers: Content-Type, Authorization Access-Control-Max-Age: 86400
The CORS Header Generator helps you build the exact set of Access-Control-* HTTP response headers needed to implement a correct Cross-Origin Resource Sharing policy for your API or web server. Configure the allowed origins (wildcard or specific domains), permitted HTTP methods, exposed and allowed request headers, credentials mode, and preflight cache duration. The tool outputs ready-to-use header values you can paste into your Nginx, Apache, Express, or any other server configuration.
QWhy can't I use a wildcard origin with credentials?
The browser security model prohibits using Access-Control-Allow-Origin: * together with Access-Control-Allow-Credentials: true. You must specify an explicit allowed origin when credentials are enabled.
QWhat is a pre-flight request?
A pre-flight is an HTTP OPTIONS request that browsers send automatically before certain cross-origin requests to ask the server which methods and headers it allows. Access-Control-Max-Age controls how long the browser can cache this response.
QDo I need CORS headers if my frontend and API are on the same domain?
No. CORS only applies to requests made from one origin (scheme + host + port) to a different origin. Same-origin requests bypass CORS checks entirely.
QCan I test whether my CORS headers are working after applying them?
Yes. Use the API Header Viewer or HTTP Request Tester tools on this site to fetch your endpoint and inspect the Access-Control-* headers in the response.