HTTP headers are an essential part of the HTTP protocol, providing metadata about the request or response. They are used to control how the browser or server handles the request or response, and they can also be used to pass additional information between the client and server.

Common HTTP Headers

Here are some of the most common HTTP headers:

  • Content-Type: Indicates the media type of the resource. For example, text/html for HTML content, image/jpeg for JPEG images, etc.
  • Accept: Specifies the types of content that the client is willing to accept in the response.
  • Authorization: Contains credentials for authentication.
  • Cache-Control: Directives for caching mechanisms.
  • Connection: Indicates whether the connection should be persistent or closed after the response is sent.

Example Usage

Here's an example of a GET request with some common headers:

GET /en/docs/http-headers HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5

Learn More

For more information about HTTP headers, you can visit our comprehensive guide on HTTP Headers.

HTTP Header Example