Skip to main content
HeadersLow PriorityPro

Access-Control-Expose-Headers

Updated November 2026·SecScanner Team

This header specifies which response headers should be exposed to JavaScript in cross-origin requests.

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

By default, only simple response headers are exposed. This header controls access to custom headers, which could leak sensitive information if misconfigured.

How We Check

We check which headers are exposed and verify no sensitive information is inadvertently leaked to cross-origin requests.

Good vs Bad Values

Good and bad values for Access-Control-Expose-Headers
ValueVerdictWhy
Access-Control-Expose-Headers: X-Request-IdGoodMakes one custom response header readable by the frontend, typically for support and tracing.
Access-Control-Expose-Headers: Content-DispositionGoodNeeded when a cross-origin download must read the suggested file name from the response.
Access-Control-Expose-Headers: Link, X-Total-CountGoodCommon for paginated APIs: the page reads the pagination links and the total from headers.
Access-Control-Expose-Headers: Retry-After, RateLimit-RemainingGoodLets client code back off politely when the API rate-limits it.
Header absentGoodOnly CORS-safelisted response headers are readable (Cache-Control, Content-Language, Content-Length, Content-Type, Expires, Last-Modified, Pragma). Fine unless the frontend needs a custom one.
Access-Control-Expose-Headers: *BadEvery response header becomes readable by an allowed origin, including internal routing and debug headers. The wildcard also does not apply to credentialed requests, so it often fails to do what the author intended.
Access-Control-Expose-Headers: AuthorizationBadExposes an authentication header to cross-origin JavaScript. The scanner flags any mention of authorization, cookie or set-cookie.
Access-Control-Expose-Headers: Set-CookieBadBrowsers never expose Set-Cookie to scripts, so it has no effect, and listing it signals a misunderstanding of the cookie model. It is flagged anyway.
Access-Control-Expose-Headers: X-Auth-TokenWeakNot on the scanner's list, but if the header holds a bearer token every allowed origin can read it. Treat token-like names with the same care as Authorization.
Access-Control-Expose-Headers: X-Backend-Server, X-Debug-TraceWeakInternal diagnostics become visible to any allowed site. Keep them out of production.

How to Fix

Only expose headers that cross-origin JavaScript legitimately needs. Avoid exposing authentication tokens or sensitive metadata.

Express with cors:

app.use(cors({
  origin: ["https://app.example.com"],
  exposedHeaders: ["X-Request-Id", "Link"],
}));

Nginx:

add_header Access-Control-Expose-Headers "X-Request-Id, Link" always;

Apache (requires mod_headers):

Header always set Access-Control-Expose-Headers "X-Request-Id, Link"

Next.js — next.config.js:

async headers() {
  return [{
    source: "/api/:path*",
    headers: [{ key: "Access-Control-Expose-Headers", value: "X-Request-Id, Link" }],
  }];
}

Cloudflare: a Transform Rule that sets the static value on your API hostname. Audit procedure. Search the frontend for response.headers.get( and getResponseHeader(; those calls are the complete list of headers worth exposing. Delete everything else from the configuration.

Verify with curl -si -H 'Origin: https://app.example.com' https://api.example.com/items | grep -i access-control-expose-headers, then confirm in the browser console that response.headers.get("X-Request-Id") returns a value.

Common Mistakes

  • Assuming a custom response header is visible to your frontend by default. It is not: without this header only the safelisted ones can be read, so `response.headers.get("X-Request-Id")` returns `null` cross-origin.
  • Fixing a missing-header bug in the frontend with `*`. Name the one or two headers you need.
  • Listing request headers here. The header controls what a page can read from a response; request headers belong in `Access-Control-Allow-Headers`.
  • Exposing session or token headers so a single-page app can read them. Use a response body or an HttpOnly cookie, and keep bearer tokens out of headers readable by third-party origins.
  • Setting it on the main page response. It is only relevant for responses to cross-origin requests, which means API and asset endpoints.
  • Copying the CORS configuration from a development proxy that exposed debug headers into production.

Frequently Asked Questions

What is Access-Control-Expose-Headers?

This header specifies which response headers should be exposed to JavaScript in cross-origin requests.

Why does Access-Control-Expose-Headers matter for website security?

By default, only simple response headers are exposed. This header controls access to custom headers, which could leak sensitive information if misconfigured.

How do I fix Access-Control-Expose-Headers issues?

Only expose headers that cross-origin JavaScript legitimately needs. Avoid exposing authentication tokens or sensitive metadata.

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-Expose-Headers issues and 61 other security checks.

Scan Your Website Free