What Are HTTP Request Headers?

HTTP Request Headers

HTTP request headers are sent by the client to the server to provide information about the request. HTTP request headers are key-value pairs. They are included in the message header of an HTTP request.

HTTP request headers are used to provide additional information about the request. This can include information regarding the content type, the date and time, and the client software that is making the request. HTTP headers allow the client to specify additional information about the request.

Example

Below is an example of HTTP request headers

GET /index.html HTTP/1.1
host: www.apitier.com
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
accept-language: en-US,en;q=0.9
referer: https://www.apitier.com/

Above example, the host, user-agent, accept-language, and referer headers are all http request headers that provide additional information about the request.

Some common request headers include:

Host

Host request headers specifies the host and port number of the server.

Refere

Refere request headers specifies the URL of the page that linked to the current page.

User-Agent

User-Agent request headers identifies the client software that is making the request.

Accept

Accept request headers indicates the acceptable content types for the response.

Accept-Encoding

Accept-Encoding request headers indicates the acceptable encodings for the response.

Accept-Language

Accept-Language request headers indicates the acceptable languages for the response.

Cache-control

Cache-control request headers specifies caching instructions for the response.

Connection

Connection request headers specifies the type of connection to be used.

Cookies

Cookies request headers sends a cookie back to the server.