Access-Control-Allow-Headers
This CORS header specifies which HTTP headers can be used during the actual cross-origin request.
Results in 1–3 minutes · Free · No signup required
Want the result for your own site? Free CORS Checker — paste your domain, get the report.
Why It Matters
Overly permissive header allowlists can enable attacks using custom headers. Restricting allowed headers limits the attack surface.
How We Check
We analyze which headers are allowed and check for overly permissive configurations or security-sensitive headers.
Good vs Bad Values
| Value | Verdict | Why |
|---|---|---|
Access-Control-Allow-Headers: Content-Type, Authorization | Good | A minimal explicit list for a JSON API with token auth. Browsers need `Content-Type` here only for non-simple values such as application/json. |
Access-Control-Allow-Headers: Content-Type | Good | Enough for plain JSON requests without a custom header. |
Access-Control-Allow-Headers: Content-Type, Authorization, X-Request-Id | Good | A short list that names each custom header the frontend really sends. |
Header absent | Good | Only CORS-safelisted request headers (Accept, Accept-Language, Content-Language and Content-Type with form or text values) are allowed. Right for simple or public GET endpoints. |
Access-Control-Allow-Headers: * | Bad | Any request header is accepted. The scanner flags the bare wildcard, and the wildcard does not cover Authorization anyway; that header must be listed by name. |
Access-Control-Allow-Headers: *, Authorization | Weak | Authorization is added by name, which is the correct way to extend a wildcard, but the wildcard still lets the page send arbitrary custom headers. Prefer an explicit list. |
Access-Control-Allow-Headers echoing Access-Control-Request-Headers | Weak | Reflecting whatever the browser asks for is a wildcard with extra steps. List the headers you accept. |
Access-Control-Allow-Headers: Content-Type, Authorization, X-HTTP-Method-Override, X-Forwarded-Host | Weak | Allowing headers that change routing or method semantics invites request smuggling and cache or logic tricks. Remove entries the application does not use. |
How to Fix
Only allow headers your application actually needs. Avoid wildcards. Common safe headers: Content-Type, Authorization, X-Requested-With.
Express with the cors package:
import cors from "cors";
app.use(cors({
origin: ["https://app.example.com"],
allowedHeaders: ["Content-Type", "Authorization", "X-Request-Id"],
maxAge: 86400,
}));
Nginx — answer preflight requests with an explicit list:
location /api/ {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Origin "https://app.example.com" always;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
add_header Access-Control-Allow-Headers "Content-Type, Authorization, X-Request-Id" always;
add_header Access-Control-Max-Age 86400 always;
add_header Vary Origin always;
return 204;
}
}
Apache (requires mod_headers):
Header always set Access-Control-Allow-Headers "Content-Type, Authorization, X-Request-Id"
Next.js — next.config.js for API routes:
async headers() {
return [{
source: "/api/:path*",
headers: [
{ key: "Access-Control-Allow-Headers", value: "Content-Type, Authorization, X-Request-Id" },
],
}];
}
Cloudflare: set the header with a Transform Rule scoped to your API hostname, or handle preflights in a Worker. How to find the list: search the frontend code for headers: in fetch and axios calls, plus anything an SDK adds, then compare against what the preflight reports as requested in Access-Control-Request-Headers.
Verify with a preflight: curl -si -X OPTIONS https://api.example.com/items -H 'Origin: https://app.example.com' -H 'Access-Control-Request-Method: POST' -H 'Access-Control-Request-Headers: authorization,content-type'.
Common Mistakes
- Using `*` to silence a preflight error in development and shipping it. Read the browser's error: it names the exact header that was missing.
- Expecting a wildcard to cover `Authorization`. It does not; the header must be named explicitly even when `*` is used.
- Listing standard CORS-safelisted headers such as `Accept` or `Accept-Language`. They never need to be listed, and a long list hides the ones that matter.
- Sending the header only on the real response. It matters on the answer to the `OPTIONS` preflight; the scanner can see it only when a normal response carries it too.
- Keeping legacy header names after a frontend rewrite. Every extra entry is an extra header an attacker's page can send with your user's credentials.
- Letting a CORS middleware, an API gateway and the application each add their own list. The browser sees merged or duplicated values and the result is hard to reason about.
Frequently Asked Questions
What is Access-Control-Allow-Headers?
This CORS header specifies which HTTP headers can be used during the actual cross-origin request.
Why does Access-Control-Allow-Headers matter for website security?
Overly permissive header allowlists can enable attacks using custom headers. Restricting allowed headers limits the attack surface.
How do I fix Access-Control-Allow-Headers issues?
Only allow headers your application actually needs. Avoid wildcards. Common safe headers: Content-Type, Authorization, X-Requested-With.
Related Security Checks
Related Tool
CORS Checker
Run all 6 related checks with our free cors checker
Check Your Website Now
Run a free security scan to check for Access-Control-Allow-Headers issues and 61 other security checks.
Scan Your Website Free