Free Online CORS Tester & Debugger
Test a cross-origin request, inspect CORS response headers, or paste headers from your browser's Network panel. Understand whether the response is readable by browser JavaScript, why a preflight may fail, and which server-side configuration needs attention.
Target server correctly allows this cross-origin request for client-side JavaScript.
Request uses CORS-safelisted method and headers; preflight OPTIONS handshake is not required.
Public access granted to all origins without credentials.
CORS-safelisted method permitted by standard browser rules without preflight.
All requested headers are standard CORS-safelisted headers.
Request does not include cookies or authorization tokens.
Only standard safelisted response headers (Content-Type, Cache-Control, etc.) are readable by JavaScript.
// Node.js Express — Hardened CORS Middleware
import express from 'express';
import cors from 'cors';
const app = express();
const allowedOrigins = ['https://app.toolmono.com'];
app.use(cors({
origin: (origin, callback) => {
// Allow requests with no origin (mobile apps, curl) or matching allowedOrigins
if (!origin || allowedOrigins.includes(origin)) {
callback(null, true);
} else {
callback(new Error('Blocked by CORS policy'));
}
},
methods: ['GET', 'POST', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'Accept'],
credentials: false,
maxAge: 86400, // Cache preflight for 24 hours
}));
How to Use
1. How to Use the CORS Tester & Debugger
ToolMono’s CORS Tester & Debugger provides two complementary diagnostic workflows: a Live Browser Test that executes authentic cross-origin requests directly from your browser, and a Pasted Header Analyzer for analyzing raw response headers captured in browser DevTools.
Dispatches a direct, client-side fetch() request from your browser memory to the target endpoint without intermediate server proxies. Evaluates whether the browser allows JavaScript to read the response under standard Same-Origin Policy rules.
Paste raw HTTP response headers directly from your browser’s Network tab (Right-click request → Copy Response Headers). Analyzes actual response headers, preflight OPTIONS headers, or both side-by-side to pinpoint conflicting or missing CORS declarations.
- Target API Endpoint: Enter the full target URL (e.g.,
https://api.example.com/v1/users). Must use valid HTTP or HTTPS syntax. - Requesting Origin: Set your client application origin (e.g.,
https://app.example.com). Origin must contain only scheme, host, and optional port (no paths or queries). - HTTP Method & Headers: Select the request method and add custom headers (such as
AuthorizationorContent-Type: application/json). - Credentials Mode: Toggle whether the request includes cookies, HTTP authentication, or client certificates (
credentials: 'include'). - Inspect Decision Matrix: Review status checks across Same-Origin, Preflight, Origin matching, Allowed Methods, Allowed Headers, and Exposed Response headers.
2. What Does a CORS Error Mean?
Cross-Origin Resource Sharing (CORS) is a browser security mechanism that relaxes the strict Same-Origin Policy (SOP) in a controlled manner. An origin is defined by the tuple of (protocol, hostname, port). When JavaScript running on https://app.example.com requests data from https://api.example.com, the browser recognizes this as a cross-origin request.
A CORS error does not mean the server rejected the request. In fact, the server may have successfully received the request, executed business logic, written data to a database, and returned an HTTP 200 OK. However, because the server omitted valid Access-Control-Allow-Origin headers, the browser refuses to expose the response body and headers to client-side JavaScript.
CORS is strictly enforced by browsers. Server-to-server HTTP requests (such as cURL, Postman, Python scripts, or backend microservices) do not enforce CORS because they lack a client-side execution sandbox where third-party untrusted scripts could steal user credentials.
3. How to Troubleshoot Common CORS Errors
Most browser CORS failures fall into one of ten specific misconfigurations:
The server returned no ACAO header. Configure the API or reverse proxy to return Access-Control-Allow-Origin: <origin> or *.
The server allowlists https://admin.example.com, but the client request arrived from https://dashboard.example.com. Update your origin allowlist.
Returning Access-Control-Allow-Origin: * alongside Access-Control-Allow-Credentials: true is forbidden by the W3C/WHATWG specifications. You must dynamically reflect the explicit origin.
Client sends DELETE or PUT, but preflight OPTIONS response omits it from Access-Control-Allow-Methods.
Client transmits Authorization or X-API-Key, but server omits it from Access-Control-Allow-Headers on the OPTIONS response.
Both NGINX and Express append an ACAO header, yielding multiple headers or comma-separated origins. Browsers reject duplicate origin headers immediately.
The Fetch spec forbids redirects on preflight requests. Trailing slash redirects or HTTP-to-HTTPS redirects on OPTIONS will trigger immediate CORS failure.
DNS failure, connection timeouts, or server crashes produce TypeError: Failed to fetch. Always verify server health in DevTools before assuming a CORS issue.
Modern browsers block active mixed content. An HTTPS client cannot fetch from an unencrypted http:// API, regardless of CORS headers.
Custom headers like X-Total-Count or X-RateLimit-Reset cannot be read by JavaScript unless explicitly listed in Access-Control-Expose-Headers.
4. Common CORS Headers Explained
Sent automatically by the browser indicating the protocol, host, and port of the calling page.
Specifies which origin(s) can read response data (* or specific origin URL).
Specifies permitted HTTP methods for preflighted requests (e.g., GET, POST, PUT, DELETE).
Lists non-safelisted request headers allowed in actual request (e.g., Authorization, Content-Type).
Set to true when the browser should expose responses to credentialed requests.
Declares custom response headers that browser JavaScript is permitted to access via getResponseHeader().
Specifies preflight caching duration in seconds (e.g. 86400 = 24 hours) to avoid redundant OPTIONS requests.
Instructs intermediate CDNs and caches that response content varies according to the requesting origin.
5. Actionable Server-Side Fixes (Express, Next.js, FastAPI, Django, NGINX)
import { NextResponse } from 'next/server';
const corsHeaders = {
'Access-Control-Allow-Origin': 'https://app.example.com',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Max-Age': '86400',
'Vary': 'Origin',
};
// Handle Preflight OPTIONS
export async function OPTIONS() {
return new NextResponse(null, { status: 204, headers: corsHeaders });
}
// Handle Actual Request
export async function GET(request: Request) {
return NextResponse.json({ message: 'Success' }, { headers: corsHeaders });
}6. Frequently Asked Questions (8 Core FAQs)
7. Authoritative Standards & References
Consult official web standards, browser security specifications, and vulnerability cheat sheets:
WHATWG Fetch Living Standard: CORS Specification
Authoritative web standard specification for the Cross-Origin Resource Sharing protocol.
MDN Web Docs: Cross-Origin Resource Sharing (CORS)
Comprehensive documentation of simple requests, preflight OPTIONS, and CORS headers.
W3C Cross-Origin Resource Sharing (CORS) Specification
Official W3C recommendation for cross-origin communication.
OWASP Cross-Origin Resource Sharing (CORS) Cheat Sheet
Industry security guidance for avoiding insecure origin reflections and credential leaks.
Related Tools
Browse all toolsHTTP Headers Checker
Check HTTP response headers online, audit security headers (CSP, HSTS, CORS), inspect cookies, detect information disclosure, and review caching policies.
HTTP Status Codes
Search, filter, and inspect all HTTP status codes (1xx–5xx). Comprehensive reference with RFC 9110 definitions, REST API guidance, practical examples, and troubleshooting steps.
GraphQL Response Analyzer
Analyze GraphQL JSON responses online. Inspect partial data, errors, response paths, null values, extensions and response structure with browser-based analysis.
.env Validator
Validate .env files, detect syntax errors, duplicate keys, empty values, potential secrets, compare environments, find missing variables, and review configuration drift.
JSON Schema Validator
Validate JSON data against a JSON Schema online with detailed errors, JSON paths, draft detection, and browser-based processing.
Webhook Tester
Generate a temporary webhook URL to capture, inspect, and debug incoming HTTP payloads, headers, and JSON in real time. Verify HMAC signatures instantly.
cURL to Code
Convert cURL commands into code for Python, JavaScript, Node.js, Go and PHP. Preserve headers, auth, cookies, and JSON bodies with ToolMono's free in-browser converter.