Skip to content

Test CORS preflight headers and origin rules

Enter an API URL and caller Origin to run a live OPTIONS preflight and header probe from our Worker. Or paste curl -i headers in your tab. Catch reflected origin leaks, wildcard credential bugs, and missing Vary: Origin rules.

Ready to run a live OPTIONS preflight or evaluate pasted headers.

Edge preflight probe · Cache-Control: no-store

Browser JS verdict
Allow

Evaluating sample policy

OPTIONS preflight
204

No redirect hops

Actual response
200

Origin + Vary checked

Security posture
0 flags

Allowlist + Vary active

Probe a live API endpoint or paste curl -i headers

Browser DevTools hides status codes and headers when CORS fails. Our Worker sends the OPTIONS preflight and Origin request from the edge so you see every header returned.

Public ports 80/443 only · private IPs blocked · Cache-Control: no-store

Live probe presets:

Probes same-origin JSON endpoint from a cross-site Origin header.

Protected by camada 16-bit SHA-256 proof-of-work · 0 third-party scripts · How it works
Pass: valid Fetch-spec CORS rule Info: caching or header exposure note Flag: browser block or credential leak

Column 1: Browser CORS verdict & findings

ALLOW

Evaluating sample allowlisted CORS headers...

  • Waiting for evaluation...

Column 2: Preflight vs actual headers

8 checks
  • HTTP status & redirects
    WAIT

    Waiting for input...

    Preflight OPTIONS must answer 2xx directly without 30x redirects.

  • Access-Control-Allow-Origin
    WAIT

    Waiting for input...

    Must match the caller Origin or * (never * with credentials).

  • Access-Control-Allow-Credentials
    WAIT

    Waiting for input...

    Only lowercase true exposes cookies to cross-origin scripts.

  • Access-Control-Allow-Methods
    WAIT

    Waiting for input...

    Must list the requested method on OPTIONS preflight responses.

  • Access-Control-Allow-Headers
    WAIT

    Waiting for input...

    Must cover Authorization and custom request headers.

  • Access-Control-Expose-Headers
    WAIT

    Waiting for input...

    Names non-SAFELISTED response headers readable in fetch().

  • Access-Control-Max-Age
    WAIT

    Waiting for input...

    Caches preflight results in browsers to cut extra OPTIONS round-trips.

  • Vary & Resource-Policy
    WAIT

    Waiting for input...

    Vary: Origin stops CDN cache poisoning across multiple origins.

Reproduce preflight in a terminal

Exact curl -i -X OPTIONS command for this probe.

curl -i -X OPTIONS "https://www.camada.app/tools/bot-test.json"

Export allowlisted CORS middleware

Pins an explicit origin allowlist, sets Vary: Origin, and caches OPTIONS.

Vary: Origin

CORS binds browsers while camada guards your routes

CORS headers tell a browser whether cross-site scripts may read a response. Shell tools, Python scrapers, and login bots skip CORS checks. Headless browsers on your own page skip them too. Lock down CORS to protect logged-in browsers. Then add camada inside your API to catch bad actors hitting your routes.

Test OPTIONS preflights from a terminal

Send Origin and Access-Control-Request-Method headers with curl to inspect localhost or staging APIs.

terminal · curl preflight
curl -sSI -X OPTIONS https://api.example.com/v1/me \
  -H "Origin: https://app.example.com" \
  -H "Access-Control-Request-Method: POST" \
  -H "Access-Control-Request-Headers: authorization, content-type"
http · allowlisted CORS
Access-Control-Allow-Origin: https://app.example.com
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: authorization, content-type
Access-Control-Max-Age: 600
Vary: Origin

1

CORS protects browsers, not your API routes

Only web browsers run CORS checks and OPTIONS preflights. Attackers running curl, Python, Go, or Node scripts skip preflights. They read every byte your API sends.

See how camada stops API and web scraping

2

Same-origin /_cam/b.js needs zero CORS rules

camada mounts its beacon and 16-bit SHA-256 challenge on your own origin. Your frontend never makes cross-origin bot-widget calls. Your CORS and CSP rules stay simple.

Explore first-party in-app bot detection

3

Link wire signals with track() outcomes

A valid Origin header can still come from a bot or proxy. Watchkeeper links wire headers, browser checks, and track('login_failed') events in memory.

Read the credential stuffing defense guide

SDK guides: Cloudflare, no code · Hono on Workers · Python · Go SDK · PHP · Ruby · Java · .NET

CORS response headers and misconfiguration risks

Browsers send an OPTIONS preflight before cross-origin calls that use PUT, DELETE, application/json, or Authorization headers.

1. Access-Control response headers

Core Fetch headers that control cross-origin reads, cookies, caching, and exposed headers.

CORS response headers reference
HeaderRecommended valueBrowser Fetch behavior
Access-Control-Allow-Originhttps://app.example.com (or * on public APIs)Names the single origin (or *) permitted to read the response body in JavaScript.
Access-Control-Allow-Credentialstrue (only with an explicit origin allowlist)Lets browsers attach cookies or TLS client certs and read the response.
Access-Control-Allow-MethodsGET, POST, PUT, DELETETells preflight checks which HTTP methods cross-origin callers may send.
Access-Control-Allow-Headersauthorization, content-typeApproves custom or non-safelisted request headers during OPTIONS preflight.
Access-Control-Expose-Headersx-request-id, ratelimit-remainingLets frontend code read custom response headers on res.headers.get().
Access-Control-Max-Age600 (10 minutes) up to 7200 in ChromiumCaches the OPTIONS preflight result so repeat calls skip the extra round-trip.
VaryOrigin (plus Access-Control-Request-Headers on preflight)Stops shared CDN caches from serving one origin header to a second origin.

2. Common CORS bugs and security leaks

These mistakes either break frontend calls or leak user data to outside sites.

Common CORS misconfigurations and fixes
MisconfigurationImpactFix
Reflecting untrusted Origin + Allow-Credentials: trueAny attacker webpage can fetch private user JSON with victim cookies.Match req.headers.origin against a strict allowlist Set before echoing it.
Access-Control-Allow-Origin: * + Allow-Credentials: trueFetch spec rejects the response in every browser with a CORS error.Return one exact allowlisted origin when you enable credentials.
Access-Control-Allow-Origin: nullSandboxed iframes and data: documents send Origin: null and can steal data.Never add null to your origin allowlist.
301, 302, or 307 redirect on OPTIONS preflightBrowsers abort preflight redirects, often on http-to-https or trailing-slash hops.Point fetch() at the final HTTPS URL and answer OPTIONS before redirects.
Dynamic Allow-Origin without Vary: OriginCDNs cache the first caller origin and break CORS for other valid origins.Always send Vary: Origin whenever Allow-Origin is not a static *.
Wildcard * on Authorization header without credentialsIn Fetch, * never covers Authorization unless Allow-Headers names it.Add authorization by name inside Access-Control-Allow-Headers.

Questions about CORS and API security

Exposing JSON routes for logins, checkouts, or AI features? Read our security overview or review plans and limits.

Why can this tool read failed CORS headers when browser DevTools hides them?
When cross-origin fetch() fails CORS, browsers hide status codes and headers. Our Worker sends the OPTIONS preflight and Origin probe from the edge. It shows the exact Access-Control-Allow-* headers and redirects your API sent.
Why does Access-Control-Allow-Origin: * fail when a request sends credentials?
Browsers block cookie requests when a server answers with a wildcard * origin. Otherwise any site could read private data with a user cookie. Echo one allowlisted origin in Access-Control-Allow-Origin and add Vary: Origin.
Why is reflecting the request Origin header with Allow-Credentials dangerous?
Suppose your API copies any Origin header into Access-Control-Allow-Origin with Allow-Credentials: true. Any attacker page can then call your API with user cookies and read private data. Always check incoming origins against a fixed allowlist.
Why do I need Vary: Origin on dynamic CORS responses?
Suppose your API sends two Access-Control-Allow-Origin headers for two allowed domains. Without Vary: Origin, a CDN cache can save the first header and serve it to the second domain. Sending Vary: Origin keys the cache by caller origin.
Does a strict CORS policy stop API scraping or credential stuffing?
No. Only web browsers run CORS checks and preflights. Scripts in curl, Go, Python, or Node skip preflights and read every byte. Add an in-app SDK like camada to spot failed logins and API abuse.

Use it from an AI agent

This page is also Markdown at /tools/cors-checker.md. The check itself runs from the form on this page.

The MCP server needs no key. Every agent tool on this site is listed in the server card and on the tools page.

Related tools

  • CSP & security headers

    Fetch live response headers or paste curl output. Flag unsafe-inline CSP rules, check HSTS and nosniff, and hash inline scripts.

  • JWT decoder

    Decode JOSE headers and payload claims in your tab with zero network calls. Verify HS256, RS256, and ES256 signatures and flag alg:none.

  • Website security check

    Enter a URL to trace HTTPS redirects, check CSP and OWASP headers, and audit cookie flags. Also checks robots.txt, llms.txt, and security.txt.

All free tools

Stop the API bots that ignore CORS rules.

Install the SDK on the Free plan to score 100,000 events a month with no card. Turn on blocks and SHA-256 challenges on Starter ($59/month) or Growth ($249/month).

Free needs no card. A 14-day trial of Starter or Growth needs a card. Nothing is charged today. Cancel before the trial ends (the date is shown in the app) and you pay nothing. Otherwise the plan's monthly price starts on day 15.