CORS Tester
Send real cross-origin requests from your browser, inspect CORS response headers, and diagnose preflight issues. Understand exactly why a request is blocked — no proxy, no server needed.
Frequently Asked Questions
What is CORS and why does it block requests?▼
CORS (Cross-Origin Resource Sharing) is a browser security mechanism that restricts web pages from making requests to a different origin (domain, protocol, or port) than the one that served the page. Browsers enforce this to prevent malicious scripts from accessing sensitive data on other sites. The server must explicitly permit cross-origin requests by sending the correct Access-Control-Allow-Origin header.
What is a preflight request?▼
A preflight request is an HTTP OPTIONS request that browsers send automatically before certain cross-origin requests — specifically those using methods other than GET/POST, or custom headers. The server must respond with the correct Access-Control headers to signal that the actual request is allowed. If the preflight fails, the browser blocks the real request entirely.
Why does Access-Control-Allow-Origin: * not work with credentials?▼
When you send credentials (cookies, HTTP auth, or client-side certificates), browsers require Access-Control-Allow-Origin to be an explicit origin, not a wildcard (*). Additionally, the server must include Access-Control-Allow-Credentials: true. Using * with credentials is explicitly forbidden by the CORS spec — the browser will reject the response even if the server sends both.
How do I fix a CORS error on my API?▼
Add the correct Access-Control-Allow-Origin header to your API responses. For public APIs, use *. For credentialed requests, reflect the requesting origin dynamically. For preflight support, also handle OPTIONS requests and return Access-Control-Allow-Methods and Access-Control-Allow-Headers. Most frameworks have CORS middleware: Express (cors package), FastAPI (CORSMiddleware), Django (django-cors-headers), etc.
What CORS headers should my API return?▼
The minimum is Access-Control-Allow-Origin. For full functionality: Access-Control-Allow-Methods (e.g. GET, POST, PUT, DELETE, OPTIONS), Access-Control-Allow-Headers (e.g. Content-Type, Authorization), Access-Control-Allow-Credentials: true (if using cookies), Access-Control-Expose-Headers (for custom response headers your client needs to read), and Access-Control-Max-Age (cache duration for preflight results, e.g. 86400 for 24 hours).
Why can't I test CORS for localhost URLs in production tools?▼
Localhost URLs (http://localhost:*) are not reachable from external servers or most proxy-based testing tools. This tester sends requests directly from your browser, so localhost URLs work fine as long as the target server is running on your machine. No proxy is involved — your browser makes the actual cross-origin request.
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
Webhook Tester
Generate realistic webhook test payloads for GitHub, Stripe, Slack, and custom services. Get a curl command to send the payload to your local endpoint. Inspect headers, payload size, and content-type.
Open free tool →
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 →
More Free Tools
Related Articles
Base64 Encoding Explained: When to Use It and When to Avoid It
Base64 encoding explained: when to use it in APIs, image data URIs, and auth tokens. Real-world examples and common pitfalls for web developers.
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.
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 →