# What does 'The value of the 'Access-Control-Allow-Origin' header must not be the wildcard '*' when credentials mode is 'include'' mean?

**Short answer:** 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

```text
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 or `withCredentials`.
- A 'fix' that reflects the request's `Origin` header for every site.

## How to fix it

1. List allowed origins explicitly and send credentials only for them:

```js
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`.

> **Scan box (use the site's ScanBox component):** Check whether your live app has this problem. Paste your URL for a free outside-in scan covering exposed keys, open database rules, CORS and security headers. [Scan my app free →](https://proofforge.live/#scan)

## 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.

## Sources

- [MDN: Credential is not supported if the CORS header is '*'](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS/Errors/CORSNotSupportingCredentials)
- [MDN: CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS)

## Related

- [Fix: CORS wildcard](/fix/cors-wildcard)
- [CORS checker](/tools/cors-checker)
- [Fix 'No Access-Control-Allow-Origin header is present'](/errors/no-access-control-allow-origin-header)
- [All errors](/errors)
