docs.rodeo

MDN Web Docs mirror

Access-Control-Expose-Headers

{{HTTPSidebar}} 

The HTTP Access-Control-Expose-Headers {{Glossary("response header")}}  allows a server to indicate which response headers should be made available to scripts running in the browser in response to a cross-origin request.

Only the {{Glossary("CORS-safelisted response header", "CORS-safelisted response headers")}}  are exposed by default. For clients to be able to access other headers, the server must list them using the Access-Control-Expose-Headers header.

Header type `{{Glossary("Response header")}}` 
`{{Glossary("Forbidden header name")}}`  No

Syntax

Access-Control-Expose-Headers: [<header-name>[, <header-name>]*]
Access-Control-Expose-Headers: *

Directives

Examples

The {{Glossary("CORS-safelisted response header", "CORS-safelisted response headers")}}  are: {{HTTPHeader("Cache-Control")}} , {{HTTPHeader("Content-Language")}} , {{HTTPHeader("Content-Length")}} , {{HTTPHeader("Content-Type")}} , {{HTTPHeader("Expires")}} , {{HTTPHeader("Last-Modified")}} , {{HTTPHeader("Pragma")}} . To expose a non-CORS-safelisted response header, you can specify:

Access-Control-Expose-Headers: Content-Encoding

To additionally expose a custom header, like Kuma-Revision, you can specify multiple headers separated by a comma:

Access-Control-Expose-Headers: Content-Encoding, Kuma-Revision

For requests without credentials, a server can also respond with a wildcard value:

Access-Control-Expose-Headers: *

A server can also respond with the * value for requests with credentials, but in this case it would refer to a header named *.

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN