Access-Control-Allow-Credentials Header Explained

What the HTTP Access-Control-Allow-Credentials header does and when it's used.

Published October 15, 2026

Access-Control-Allow-Credentials: true permits the browser to expose responses to requests made with cookies or HTTP auth. It cannot be combined with a wildcard origin.

How it works

The client must also set credentials: 'include' (fetch) or withCredentials.

The Access-Control-Allow-Credentials header is part of the HTTP message and is case-insensitive in name.

In a real exchange

curl -i https://example.com/
Access-Control-Allow-Credentials: true
Where Access-Control-Allow-Credentials appears.

Practical examples

The header

Access-Control-Allow-Credentials: true

Set or use it in code

fetch(url, { credentials: 'include' })

Inspect it

curl -sI https://example.com | grep -i 'access-control-allow-credentials'

Common mistakes

  • Using * for Allow-Origin together with credentials
  • Forgetting client-side credentials option
  • Setting SameSite=Strict and breaking cross-site cookies

Key takeaways

  • Access-Control-Allow-Credentials: Access-Control-Allow-Credentials: true permits the browser to expose responses to requests made with cookies or HTTP auth.
  • Check it in browser DevTools → Network.
  • Test with curl -I before deploying.

FAQ

Why is a wildcard rejected?

Credentialed requests require an explicit origin.

Is Access-Control-Allow-Credentials case sensitive?

Header names are case-insensitive; values may not be.

More HTTP articles