e01.org

Fetch metadata request header

A fetch metadata request header is an HTTP request header that provides additional information about the context from which the request originated. This allows the server to make decisions about whether a request should be allowed based on where the request came from and how the resource will be used.

A **fetch metadata request header** is an HTTP request header that provides additional information about the context from which the request originated. This allows the server to make decisions about whether a request should be allowed based on where the request came from and how the resource will be used.

With this information a server can implement a resource isolation policy, allowing external sites to request only those resources that are intended for sharing, and that are used appropriately. This approach can help mitigate common cross-site web vulnerabilities such as CSRF, Cross-site Script Inclusion (XSSI), timing attacks, and cross-origin information leaks.

These headers are prefixed with `Sec-`, and hence are forbidden request headers. As such, they cannot be modified from JavaScript.

The fetch metadata request headers are:

- Sec-Fetch-Site
- Sec-Fetch-Mode
- Sec-Fetch-User
- Sec-Fetch-Dest

The following request headers are not _strictly_ "fetch metadata request headers", as they are not in the same specification, but similarly provide information about the context of how a resource will be used.
A server might use them to modify its caching behavior, or the information that is returned:

- Sec-Purpose
- Service-Worker-Navigation-Preload

## See also

- [Fetch metadata](/docs/Web/HTTP/Guides/Fetch_metadata)
- [Protect your resources from web attacks with Fetch Metadata](https://web.dev/articles/fetch-metadata) (web.dev)
- [Fetch Metadata Request Headers playground](https://secmetadata.appspot.com/) (secmetadata.appspot.com)
- [List of all HTTP headers](/docs/Web/HTTP/Reference/Headers)
- [List of all HTTP headers > Fetch metadata request headers](/docs/Web/HTTP/Reference/Headers#fetch_metadata_request_headers)
- Related glossary terms:
- Representation header
- HTTP header
- Response header
- Request header

source: MDN Web Docs mirror · page

Cite this

"Fetch metadata request header". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Glossary/Fetch_metadata_request_header

JSON record · API collection · citation policy