Reproduce a CORS error before you change the server
Type the request Origin, method, headers and credentials mode, and the response headers your server sends. CorsLab decides whether the browser sends a simple request or an OPTIONS preflight first, then checks the response against the Fetch Standard: allow-origin, methods, headers, credentials, exposed headers, max-age and Vary. When it blocks, you get the console wording the browser prints and the exact header to fix — plus the same allowlist as Cloudflare Workers, Nginx, Express and Apache code.
In one line: CorsLab replays and judges CORS requests and responses locally, and generates the server configuration for you.
- 100%runs in the browser
- 6synthetic presets
- 4server targets
- 0uploads
① Request and response simulator
Client request on the left, the response headers your server actually sends on the right. Every edit re-runs the verdict below.
Client request
Headers outside the safelisted set (Content-Type with an unusual value, Authorization and so on) trigger a preflight.
Server response headers
② Verdict
Split into the two stages the Fetch Standard uses: the preflight response, then the actual response.
The preflight the browser sends
The preflight goes out once before the real request, and the real request is only sent if it passes.
Preflight response checks
Actual response checks
Message shown in the browser console
This is the wording Chromium-based browsers actually print (English, verbatim). Look for it in DevTools, not in the server log.
How to fix it
③ Server configuration generator
Give it the allowed origins and it writes configuration that echoes the origin only when it is on the list — never a blind reflection. Adjust paths and ports for your environment before you deploy.
Write scheme and host exactly, with no trailing slash (for example https://app.example.com).
Code per server
The generated code is a starting point. Before deploying, check the proxy target, path and TLS setup, and verify again with an integration test.
④ Export the report
Copy or download the request, response and verdict on screen as a Markdown table or JSON. The file is built in the browser and never uploaded.
Markdown preview
How it works
It follows the CORS check procedure of the Fetch Standard, and every decision is made inside your browser.
GET, HEAD or POST, every request header is a safelisted one, and Content-Type is one of the three allowed values, the request goes out with no preflight.OPTIONS with Origin, Access-Control-Request-Method and Access-Control-Request-Headers, and checks the status code and the Allow-* headers of that response.Access-Control-Allow-Origin and Allow-Credentials are checked again, and only headers listed in Expose-Headers become readable to the script.Frequently asked questions
Is my Origin or header uploaded anywhere?
No. There is no server code, no API and no account here. The verdict and the generated code are produced by JavaScript in your browser, and your input is not sent to a server (advertising and affiliate widgets excluded). Close the page and the input is gone; only your theme choice is kept in localStorage.
When is a preflight sent?
When the method is not GET, HEAD or POST, when a request header is not on the safelisted list (Accept, Accept-Language, Content-Language, Content-Type, Range), or when Content-Type is not application/x-www-form-urlencoded, multipart/form-data or text/plain. An Authorization header or an application/json body is the usual trigger.
Why can't I use * with credentials: include?
Because a wildcard on a request that carries cookies would let any site read the response with the user's session. The specification forbids `*` in `Access-Control-Allow-Origin`, `Allow-Methods` and `Allow-Headers` when the credentials mode is include. Echo the request origin and add `Vary: Origin`.
What actually goes wrong without Vary: Origin?
A CDN or reverse proxy can cache the response for site A (ACAO: https://a.com) and serve it to site B, which then gets blocked — or, in the other order, an origin that should have been rejected receives the response. Whenever Allow-Origin is dynamic, send `Vary: Origin` with it.
Can the verdict differ from a real browser?
The tool applies the Fetch Standard checks to the values you enter. A real browser also considers redirects, private network access, service workers and cache state. Confirm the final behaviour in the DevTools network panel and with an integration test.
Can I deploy the generated configuration as-is?
It is a starting point. Paths, proxy targets, ports and TLS termination differ per environment, and each stack has its own caveats (add_header inside an Nginx if, Header always set in Apache). Review it and re-test before deploying.
What Max-Age should I use?
A longer cache saves a round trip per request, but permission changes then take longer to apply. Around 600 seconds is a safe default, and Chromium-based browsers cap the preflight cache at 7200 seconds even if you send more.
Does this apply to mobile apps or other server languages?
The rules are platform independent. Native apps are not subject to CORS, but WebViews and hybrid apps are. Server-side, the same headers apply, so the guidance carries over to Go, Python, Java and the rest.
CORS guides for real deployments
From preflight conditions to per-server configuration, ordered the way real incidents are fixed.
- When a CORS preflight (OPTIONS) is sent, and what the browser checksThe exact conditions that make the browser send OPTIONS before the real request, the three headers it carries, and the order in which the response is checked.
- Access-Control-Allow-Origin, credentials: include and the wildcard banExact-match rules for Allow-Origin, the multiple-value error, why * is forbidden with credentials, and the three headers the rule applies to.
- Simple-request checks: method, headers and Content-TypeThe Fetch Standard safelist explained value by value, including the byte rules for header values and the Range exception.
- Vary: Origin and CDN cache poisoningHow a cache that keys on the URL alone reuses the wrong response, what it looks like in both directions, and how to set Vary: Origin on each platform.
- CORS configuration per server: Workers, Nginx, Express and ApacheThe same allowlist implemented safely on four platforms, with the pitfall each one hides — and a deployment checklist.
0 bytes of your input sent to a server (advertising and affiliate widgets excluded)