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.
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 →Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
CORS Policy Builder
Generate CORS configuration for Express.js, Nginx, FastAPI, Django, Koa, Laravel, and Spring Boot. Set allowed origins, methods, headers, credentials, and max-age.
Open free tool →
OpenAPI Validator
Paste your OpenAPI 3.x spec (YAML or JSON) to validate structure, find missing required fields, detect duplicate paths, check for missing operationIds, and get errors and warnings with path references.
Open free tool →
HTTP Status Code Reference
Complete HTTP status code reference. Search all 1xx, 2xx, 3xx, 4xx, and 5xx codes with plain-English descriptions, real-world use cases, and when to use each in REST APIs.
Open free tool →
More Free Tools
Related Articles
HTTP Headers Explained: Security & Performance (2025)
A developer's guide to HTTP headers. Covers security headers (HSTS, CSP, CORS), performance headers (Cache-Control, ETag), and how to inspect headers with free tools.
Base64 Encode/Decode Explained: When and How to Use It
Understand when to use Base64 encoding and when to avoid it. This guide explains the Base64 algorithm, practical use cases, code examples in JavaScript, Python, Go, and more.
Complete HTTP Status Codes Reference for REST API Devs
The complete HTTP status codes reference for REST API developers. Every 1xx, 2xx, 3xx, 4xx, and 5xx code explained with real-world API examples and best practices.
JWT Decoder: How to Read Token Payloads
Learn how to decode JWT tokens and read their payloads. A practical guide to JWT structure, claims, expiry checking, and debugging auth issues with a free online decoder.
HTTP Status Codes Explained: Complete Guide for Developers
Every HTTP status code group explained with real-world examples. Know exactly when to use 200, 201, 301, 401, 404, 429, 500, and more.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →