Free CORS Policy Checker
Validate Access-Control headers, credentials safety, and preflight behavior. Catches wildcard-with-credentials and missing Vary: Origin, with copy-paste fixes.
- ACAO configuration
- Preflight simulation
- Credentials safety

What you get for free
18 core security checks via this tool, passive scans, step-by-step remediation, security score on every result.
What Essential adds at $39/mo
+17 advanced checks, continuous monitoring, daily security score history, email alerts, GitHub SAST, board-ready PDFs, SOC 2 / ISO 27001 / PCI reports.
What is CORS?
Cross‑Origin Resource Sharing (CORS) controls which origins can read your API responses in browsers. Correct configuration prevents data exfiltration while allowing legitimate cross‑site apps.
Why CORS matters
A lax policy can expose private data to attacker-controlled origins. Overly strict settings break legitimate clients. The goal is least‑privilege, origin‑scoped access.
What this checker validates
- ACAO/ACAC/ACAH/ACEH values and consistency
- Credentials with wildcard origin (disallowed)
- Preflight handling (methods/headers) and Vary: Origin
- Max‑Age and exposure of sensitive headers
Across 1,067 recent CORS checks, 16.7% have an overly-permissive Access-Control-Max-Age and 7.7% are missing Vary: Origin on credentialed responses.
How to fix common failures
- When using credentials, set ACAO to the specific request origin, not "*"
- Return Vary: Origin so caches keep responses per origin
- Limit ACEH to required headers only
- Whitelist only necessary methods in preflight
Implementation examples
Once you've identified the gap, applying the fix is straightforward. Here are the three configurations developers reach for most often.
Nginx
map $http_origin $cors_origin {
default "";
"https://app.example.com" $http_origin;
}
server {
location /api/ {
if ($cors_origin) {
add_header Access-Control-Allow-Origin $cors_origin always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
add_header Access-Control-Allow-Headers "Authorization, Content-Type" always;
add_header Vary "Origin" always;
}
if ($request_method = OPTIONS) {
add_header Access-Control-Max-Age 600;
return 204;
}
}
}Apache
<IfModule mod_headers.c>
SetEnvIf Origin "^https://app\.example\.com$" CORS_ORIGIN=$0
Header always set Access-Control-Allow-Origin "%{CORS_ORIGIN}e" env=CORS_ORIGIN
Header always set Access-Control-Allow-Credentials "true" env=CORS_ORIGIN
Header always set Access-Control-Allow-Methods "GET, POST, OPTIONS" env=CORS_ORIGIN
Header always set Access-Control-Allow-Headers "Authorization, Content-Type" env=CORS_ORIGIN
Header always set Vary "Origin"
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=204,L]Node.js (Express + cors)
import express from "express"
import cors from "cors"
const allowedOrigins = ["https://app.example.com"]
const app = express()
app.use(
cors({
origin: (origin, cb) => {
if (!origin || allowedOrigins.includes(origin)) return cb(null, true)
return cb(new Error("Not allowed by CORS"))
},
credentials: true,
methods: ["GET", "POST", "OPTIONS"],
allowedHeaders: ["Authorization", "Content-Type"],
maxAge: 600,
}),
)Tool-specific questions
Can I use * with credentials?
Do I need Vary: Origin?
Should I expose Authorization?
How do I debug preflight failures?
Built for the engineers who already have enough to fix.
Real-time results
Comprehensive checks
Step-by-step fixes
More free checks, for the rest of your surface.
Complete Security Scan
Pre-Pentest Security Scan
Security Compliance Checker
WAF Checker
Security Headers Test
TLS/SSL Security Checker
Go deeper on the same topic.
Cors Security
Cors Misconfiguration
Api Security Testing Checklist
Frequently asked.
What is Barrion and how does it enhance website security?
How safe is Barrion to use for security testing?
What types of security issues does Barrion identify?
What specific security checks does Barrion perform?
What is Barrion's smart crawling?
How often does Barrion perform security scans?
Is Barrion suitable for security testing of all business sizes?
How does Barrion handle data security and privacy during security testing?
What if I'm not satisfied with Barrion's security testing service?
How does Barrion help with SOC 2, ISO 27001, NIS2, and other compliance frameworks?
Anything else? Email contact@barrion.io.
Run a full report on your site.
Free first scan covers every check, no signup needed. Sign up to save the report and turn on continuous monitoring.