HTTP Headers

HTTP headers are a means for a client, server, and any intermediaries to exchange information during the HTTP request-response process.

Usage

HTTP headers are a pillar of HTTP messages. Servers and clients alike rely on the information exchanged in HTTP headers regardless of whether they are in the HTTP request or HTTP response. There are HTTP request-specific headers that might contain information about the client, HTTP response-specific headers that may contain details about the host, and HTTP headers that are common on both sides of the conversation. A representational HTTP header, for example, contains information about the body of the resource such as how it is encoded. There are also payload headers, which hold representation-independent information such as the size of the message body.

HTTP headers can be further characterized by their scope within the message chain. An end-to-end header that is sent by the client must be transmitted to the server, unmodified by intermediaries, and stored by caches as appropriate. Conversely, a hop-by-hop header is only relevant between nodes, and as such, not forwarded or stored by caches.

There are many different types of HTTP headers that describe or govern processes such as authentication, caching, message body information, and proxies. For example, Cookies are transmitted via HTTP headers, and they are responsible for maintaining the current client’s state in a stateless system.

HTTP header categories and names

Authentication

Caching

Client Hints

Network client hints

Conditionals

Connection Management

Content negotiation

Controls

Cookies

CORS

Downloads

Message body information

Proxies

Redirects

Request context

Response context

Range requests

Security

Fetch metadata request headers

Server-Sent events

Transfer coding

WebSockets

Other

Takeaway

HTTP headers are part of the HTTP messaging architecture, with both client and server relying on them for information, direction, and general assistance.

Last updated: June 20, 2022