What does 'The value of the 'Access-Control-Allow-Origin' header must not be the wildcard '*' when credentials mode is 'include'' mean?
Your request sends cookies or auth (credentials: 'include'), and the server answered Access-Control-Allow-Origin: *, which browsers forbid for credentialed requests. Return your exact origin and Access-Control-Allow-Credentials: true. Don't echo back whatever Origin arrives, because that lets any website read your users' data.
Last updated 2026-11-25 · Reviewed by ProofForge
The exact error
Access to fetch at 'https://api.example.com/me' from origin 'https://app.example.com' has been blocked by CORS policy: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.Why it happens
cors()with default options (which sends*) combined with cookies orwithCredentials.- A 'fix' that reflects the request's
Originheader for every site.
How to fix it
- List allowed origins explicitly and send credentials only for them:
const allowed = new Set(['https://app.example.com'])
app.use((req, res, next) => {
const o = req.headers.origin
if (o && allowed.has(o)) {
res.setHeader('Access-Control-Allow-Origin', o)
res.setHeader('Access-Control-Allow-Credentials', 'true')
res.setHeader('Vary', 'Origin')
}
next()
})Check it's fixed
Send curl -H 'Origin: https://evil.example' -I https://api.example.com/me. The response must not include access-control-allow-origin: https://evil.example.
Check your live app
A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.
FAQ
Why is reflecting the Origin dangerous?
With credentials allowed, any site a signed-in user visits can call your API as that user and read the response.
Do I need credentials at all?
Only if the API uses cookies. Token-in-header APIs can use credentials: 'omit'.
Does ProofForge test this?
Yes. The scan sends a request with a foreign Origin and reports whether it's reflected along with credentials.