Skip to main content

CORS Policy Tester

Visually test your CORS configuration without writing any code. Fill in the requesting origin and your server's CORS response headers to see whether the browser would allow or block the request — and why. Also generates the equivalent preflight OPTIONS response.

✓ Color-coded allow/block result ✓ Preflight OPTIONS simulation ✓ Wildcard + credentials check ✓ Runs 100% in your browser
CORS Configuration

The origin making the cross-origin request (from browser)

CORS Request Flow

Browser → OPTIONS preflight → Server
Checks: Origin, Method, Headers allowed?
Browser ← 200 + CORS headers ← Server
Browser → Actual request → Server
Simple requests (GET/POST with basic headers) skip the preflight step.

Frequently Asked Questions

What is CORS and why does the browser enforce it?▼

CORS (Cross-Origin Resource Sharing) is a browser security mechanism that restricts how web pages can request resources from a different origin (domain, protocol, or port) than the one that served the page. The browser enforces this to protect users — without CORS, a malicious page could silently make requests to your bank or email using your existing session cookies. CORS headers on the server tell the browser which cross-origin requests are safe to allow. Note: CORS is enforced by the browser only; it does not protect your server from direct requests (e.g., from curl or server-to-server calls).

What is a CORS preflight request?▼

A preflight request is an automatic OPTIONS request the browser sends before a 'non-simple' cross-origin request. Simple requests are GET/POST with only basic headers (Content-Type: text/plain, etc.). Any request with custom headers, Content-Type: application/json, or methods like PUT/DELETE/PATCH triggers a preflight. The browser sends OPTIONS to the target URL asking if the actual request is permitted. The server must respond with the correct Access-Control-Allow-* headers. If the preflight fails, the browser never sends the actual request.

Can I use Access-Control-Allow-Origin: * with credentials?▼

No. This is one of the most common CORS mistakes. If Access-Control-Allow-Credentials is set to 'true', the browser requires Access-Control-Allow-Origin to be an explicit origin (not the wildcard *). Using * with credentials=true causes the browser to block the request. You must echo back the specific requesting origin in Access-Control-Allow-Origin. Also, the requesting code must explicitly set credentials: 'include' in the fetch call. This pairing requirement exists to prevent credential-bearing requests from being inadvertently allowed to any origin.

What does Access-Control-Max-Age do?▼

Access-Control-Max-Age tells the browser how many seconds to cache the result of a preflight OPTIONS request. During this time, the browser will skip sending another OPTIONS request for the same URL+method+headers combination and allow the actual request directly. A value of 86400 (24 hours) is common for production. Without this header, the browser uses a short default (typically 5 seconds in Chrome), which means a preflight is sent for every unique cross-origin request, adding latency. Setting a long max-age reduces this overhead significantly for high-frequency API calls.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

CORS Policy Builder OpenAPI Validator HTTP Status Code Reference API Request Builder API Response Mock Generator HTTP Status Code Reference HTTP Status Code Lookup HTTP Status Code Lookup API Response Time Tester HTTP Methods Reference CORS Header Analyzer OpenAPI Schema Validator OpenAPI Mock Generator API Test Case Generator HTTP Headers Analyzer API Response Formatter & Analyzer HTTP API Tester HTTP Security Headers Generator HTTP Status Code Reference CORS Policy Validator HTTP Header Analyzer API Mock Server Config Generator REST API Request Builder HTTP Security Headers Checker API Response Mocker API Rate Limit Calculator CORS Tester CORS Header Tester HTTP Headers Inspector HTTP Code Snippet Generator HTTP Mock Response Builder LLM Cost Calculator HTTP Cache-Control Builder AI Prompt Cost Calculator HTTP/2 Server Push Headers Builder Mock Service Worker (MSW) API Mocking Guide Content Security Policy Builder LLM Prompt Cost Calculator HTTP Header Inspector AI Rate Limit Calculator HTTP Cache Header Builder Prompt Injection Tester GCP Service Account Key Auditor API Key Generator AI Doc Generator — Pro Tool AI System Guardian curl Command Builder .htaccess Generator JSON Diff Viewer JSON Diff nginx Config Generator Password Strength Checker Developer Utilities Rate Limiter Tester API Changelog Generator CSP Header Builder Rate Limit Calculator Webhook Tester AWS IAM Policy Validator Haproxy Config Validator Caddy Caddyfile Generator HTTP Cookie Parser HAR Diff Analyzer SBOM Generator Vue Component Generator LLM Context Window Calculator LLM Token Counter Dockerfile Linter SSL Certificate Checker Prompt Token Estimator nginx Config Builder Pulumi Modern IaC Guide Docker Layer Optimizer HTML5 Canvas API Playground Token Context Calculator OpenAI Function Calling Generator Token Counter & Cost Estimator AI API Rate Limit Calculator Password Strength Analyzer

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →