Request headers
Introduction
HTTP request headers are key-value pairs sent by a client (such as a web browser or API client) to a server as part of an HTTP request. These headers provide additional information about the request, helping the server understand how to process it. They can include details about the client, request type, accepted content, authentication, caching, and more.
Headers play a crucial role in web communication, enabling functionality such as content negotiation, security enforcement, and efficient data transfer. Below is a comprehensive list of commonly used HTTP request headers along with a brief description of their purpose.
Common request headers
Below is a table of common HTTP request headers and info about their usage:
Header Name | Description |
---|---|
Accept-Charset | Specifies the character sets the client can handle. |
Accept-Encoding | Specifies the encoding methods the client can accept. |
Accept-Language | Specifies the preferred languages for the response. |
Accept | Specifies the media types the client can process. |
Authorization | Contains credentials for authentication. |
Cache-Control | Controls caching behavior of the request. |
Connection | Specifies control options for the current connection. |
Content-Length | Indicates the size of the request body in bytes. |
Content-Type | Specifies the media type of the request body. |
Cookie | Sends stored HTTP cookies to the server. |
DNT (Do Not Track.md) | Indicates the user's tracking preference. |
Expect | Specifies expected behavior from the server. |
Forwarded | Contains information about a forwarded request by a proxy. |
From | Provides an email address of the user making the request. |
Sec-Gpc | Indicates the user's PII tracking preferences. |
Host | Specifies the domain name of the server handling the request. |
If-Match | Used for conditional requests based on ETag matching. |
If-Modified-Since | Sends the last modification date to check for updates. |
If-None-Match | Requests resources only if they do not match a given ETag. |
If-Range | Requests a specific range of data if the entity remains unchanged. |
If-Unmodified-Since | Requests resources only if they have not been modified. |
Origin | Indicates the origin of the request for CORS purposes. |
Pragma | Provides backward compatibility with HTTP/1.0 caches. |
Priority | Specifies the priority of the request. |
Proxy-Authorization | Contains credentials for authenticating with a proxy. |
Range | Requests a specific byte range of a resource. |
Referer | Specifies the referring webpage for the request. |
Sec-Fetch-Dest | Indicates the destination of a requested resource. |
Sec-Fetch-Mode | Indicates the request mode used when fetching a resource. |
Sec-Fetch-Site | Indicates the context of the request's origin. |
TE | Indicates supported transfer encodings. |
Upgrade | Requests an upgrade to a different protocol. |
User-Agent | Identifies the client software making the request. |
Via | Provides information about intermediaries handling the request. |
Warning | Sends additional information about the status of a request. |