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.
The origin making the cross-origin request (from browser)
Header Analysis
Preflight OPTIONS Response (simulated)
CORS Request Flow
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.
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.
curl 深度使用手冊:API 測試從入門到進階
curl 是每位開發者必備的 CLI 工具。本文涵蓋 GET/POST/PUT/DELETE 請求、認證、header 設定、檔案上傳、除錯技巧,以及 REST API 測試的完整實戰範例。
JWT Authentication Best Practices 2026: Secure Your API Tokens
Complete JWT security guide for 2026. Covers RS256 vs HS256 signing, token storage strategies, expiry and refresh token patterns, revocation, common vulnerabilities, and a production security checklist.
Web Security in 2026: CSP, CORS, and Modern Auth Patterns
Master content security policy, CORS configuration, and WebAuthn passkeys. Practical security patterns for modern web applications.
API Rate Limiting: Algorithms and Implementation Guide 2026
Complete guide to API rate limiting in 2026. Token Bucket, Leaky Bucket, Sliding Window algorithms with Node.js and Redis implementations, distributed rate limiting, 429 handling, and best practices.
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 →