1. Home
  2. Developer tools
  3. CORS Header Generator and Tester

CORS Header Generator and Tester

Understand why a browser blocked a request, and get the exact headers and server configuration that fix it.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use CORS Header Generator and Tester

  1. Enter the request origin, method and headers.
  2. Set the allowed origins and options.
  3. Read the verdict and copy the server configuration.

Features

  • Simple versus preflighted request detection
  • Checks origin, method, headers and credentials rules
  • Wildcard-with-credentials error explained
  • Config for Express, nginx, Apache, Cloudflare and others
  • Vary: Origin handled
  • Follows the Fetch standard

Supported formats

Input

  • Origin, method and header values

You get

  • Verdict
  • Server configuration

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the CORS Header Generator and Tester is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • It models the Fetch standard but does not send real requests.
  • Server configuration snippets are starting points and may need adapting.

Guide

CORS headers, preflight requests and the errors browsers show

A web page can freely display images and run scripts from other sites, but it cannot read the responses of a fetch or XMLHttpRequest to another origin unless that origin agrees. The agreement is called cross-origin resource sharing, CORS, and it is made with response headers. When it goes wrong the browser prints a red error and the call fails, which makes CORS the most common source of confusion for people who build front ends against an API. This page generates the headers and also tests a request against them.

Simple and preflighted requests

The Fetch standard splits requests into two groups. A simple request uses GET, HEAD or POST, no custom headers and a form-like content type; the browser sends it straight away and then checks the response headers before letting the script read it. Everything else, including a JSON body (Content-Type: application/json), a PUT or DELETE, or an Authorization header, is preflighted: the browser first sends an OPTIONS request that asks permission, naming the method and headers, and only sends the real request if the answer approves it.

The headers

Access-Control-Allow-Origin names the one origin that may read the response, or * for any. It cannot list several. Access-Control-Allow-Methods and Access-Control-Allow-Headers answer the preflight. Access-Control-Allow-Credentials: true lets the request carry cookies or HTTP authentication, and it cannot be combined with a wildcard origin, methods or headers. Access-Control-Expose-Headers lets scripts read response headers beyond the basic set, and Access-Control-Max-Age tells the browser how long to cache the preflight result.

What the generator writes

Enter your allowed origins, one per line. For one origin the page writes it directly. For several, it explains the pattern servers must follow: compare the request’s Origin header with your list and echo the match, adding Vary: Origin. The default settings produce Access-Control-Allow-Origin: https://app.example.com, methods GET, POST, OPTIONS, headers Content-Type, Authorization and Access-Control-Max-Age: 600. Pick a server tab to get the same rules as configuration for your platform.

Using the tester

On the Test tab, fill in the page origin where the script runs, the method, any custom request headers, the content type of the body and whether the request includes credentials. Then paste the response headers your server sent to the preflight OPTIONS request, if one is needed, and to the real request. The page walks through the browser’s steps one at a time and reports where it fails: no Allow-Origin header, a mismatched origin, a method missing from Allow-Methods, a header missing from Allow-Headers, or a credentials request combined with a wildcard. Checking the preflight and the actual response separately matches what the browser does.

Limits

CORS governs what browsers let scripts read. It does not stop curl, servers or other programs from calling your API, so it is not authentication or access control. The tester models the Fetch standard and does not send real requests. Configuration snippets are starting points that you should adapt to your stack, particularly for dynamic origin lists.

Checked against the current version of the CORS Header Generator and Tester on .

Frequently asked questions

Why does the browser say the preflight response did not pass the access control check?

The OPTIONS request that the browser sent first did not get an acceptable answer: the server returned an error status, no Access-Control-Allow-Origin, or did not list the method or header you want to use. The generator output shows the complete answer the server should give.

What does Vary: Origin do?

When the server echoes a different Allow-Origin value for different callers, caches must not reuse one response for another site. Vary: Origin tells them to key the cache by the Origin header.

Why can’t I list several origins in Access-Control-Allow-Origin?

The header takes one origin or a wildcard. For several sites the server compares the request’s Origin with an allow-list and echoes the match, adding Vary: Origin.

Does CORS protect my API?

It only stops other websites’ scripts in a browser from reading responses. Servers and tools such as curl are not affected, so you still need authentication.

Keep working with the result

openWorkstand also includes a free workspace with documents, spreadsheets, tasks, projects and a calendar that save to a folder on your computer.