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

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)
- Vary: Origin on responses that echo the 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/ {
# Preflight. Headers are repeated here because nginx "if"
# blocks do not inherit add_header from the surrounding scope.
if ($request_method = OPTIONS) {
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 Access-Control-Max-Age 600 always;
add_header Vary "Origin" always;
return 204;
}
# Actual responses. nginx omits an add_header whose value is
# empty, so a non-allowlisted origin (empty $cors_origin) gets
# no Access-Control-Allow-Origin header at all.
add_header Access-Control-Allow-Origin $cors_origin always;
add_header Access-Control-Allow-Credentials "true" always;
add_header Vary "Origin" always;
}
}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.
Fast 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?
How safe is Barrion to use for security testing?
What types of security issues does Barrion identify?
What specific security checks does Barrion perform?
Will our auditor or enterprise customer accept the report?
How often does Barrion test my app?
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.
Fix it once, then watch it stay fixed.
A pentest shows what is exploitable today. A scheduled passive scan re-checks this tool's results and alerts you when a deploy undoes the fix.
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 from €199/mo
Pentest credits every month, +17 advanced checks, weekly passive scans, email alerts and audit-ready PDFs for SOC 2 / ISO 27001 / PCI.