Skip to main content

CORS Policy Checker

Test any URL for CORS headers, analyze Access-Control-* response headers with plain-English explanations, and generate ready-to-copy CORS configuration for Nginx, Express, Apache, CloudFront, and Fastify.

✓ Real browser CORS check ✓ Header simulator (paste from curl) ✓ Auto-generates server configs ✓ Runs 100% in your browser

Frequently Asked Questions

What is CORS and why do browsers enforce it?▼

CORS (Cross-Origin Resource Sharing) is a security mechanism enforced by browsers that controls which origins (domain + protocol + port combinations) can read responses from a different origin. Without CORS, a malicious site could silently make authenticated requests to your bank or API using your cookies. CORS does NOT affect server-to-server requests — only browser-initiated ones. curl and Postman ignore CORS entirely.

What is a CORS preflight request?▼

A preflight is an automatic OPTIONS request the browser sends before a 'non-simple' cross-origin request. Non-simple requests include any method other than GET/HEAD/POST, custom headers like Authorization, or Content-Type values other than form types. The browser checks the OPTIONS response for Access-Control-Allow-Methods and Access-Control-Allow-Headers before sending the actual request. If the preflight fails, the real request is never sent. Use Access-Control-Max-Age to cache preflight results and avoid repeated OPTIONS round-trips.

What does Access-Control-Allow-Origin: * mean, and when should I avoid it?▼

The wildcard (*) allows any origin to read the response. It is appropriate for fully public APIs that return no user-specific data — for example, a public weather API or open data endpoint. You must NOT use * when: (1) the endpoint returns sensitive or user-specific data, (2) the client sends credentials (cookies or Authorization headers) — browsers will reject wildcard + credentials as invalid, or (3) you want to restrict access to known partners. In those cases, explicitly list trusted origins and reflect the matching one in the response.

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

No — this combination is explicitly invalid per the CORS specification and all modern browsers will block the response with an error. When credentials mode is enabled (fetch with credentials: 'include', or XMLHttpRequest with withCredentials: true), the server must respond with an explicit origin (e.g. Access-Control-Allow-Origin: https://yourapp.com) rather than *. The server must also set Access-Control-Allow-Credentials: true. This prevents credential-bearing requests from being silently accepted by every site on the internet.

What is the difference between CORS and CSRF?▼

CORS and CSRF (Cross-Site Request Forgery) are complementary but different protections. CORS controls whether a browser allows a script to READ a cross-origin response. CSRF protects against a malicious site WRITING (sending requests) on behalf of a logged-in user without their consent. CORS does not prevent CSRF — simple GET/POST requests that don't read responses can still be CSRF attacks. You need CSRF tokens or SameSite cookie attributes to defend against CSRF. Together, both protections provide layered defense for cross-origin interactions.

Why does my API work in Postman or curl but fail in the browser?▼

CORS is a browser-only enforcement mechanism. curl, Postman, server-side Node.js, Python scripts, and all non-browser HTTP clients never check or enforce CORS headers — they always send and receive responses regardless. This is why testing with curl may succeed while your frontend React or Vue app gets blocked. The fix is always on the server side: add the correct Access-Control headers to your API responses. The browser reads those headers and decides whether to expose the response to your JavaScript code.

Looking for more free developer tools?

Browse All Free Tools →
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 Security Headers 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 HTTP Security Headers Checker CORS Policy Tester OpenAPI Mock Generator API Test Case Generator HTTP Headers Analyzer API Response Formatter & Analyzer HTTP API Tester CORS Header Tester HTTP Status Code Reference CORS Policy Validator HTTP Header Analyzer HTTP/2 Server Push Headers Builder API Mock Server Config Generator REST API Request Builder API Response Mocker HTTP Header Inspector HTTP Cache Header Builder API Rate Limit Calculator CORS Tester HTTP Headers Inspector HTTP Code Snippet Generator HTTP Mock Response Builder LLM Cost Calculator HTTP Cache-Control Builder AI Prompt Cost Calculator Mock Service Worker (MSW) API Mocking Guide Content Security Policy Builder LLM Prompt Cost Calculator AI Rate Limit Calculator 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 CORS Headers Checker Docker Layer Optimizer HTML5 Canvas API Playground Token Context Calculator GraphQL Client Configurator 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 →