HTTP Headers are packets of information that are sent along with HTTP requests that allow a server and a client to exchange useful additional information along with the actual data being exchanged.
HTTP Headers serve a multitude of purposes, but broadly fall into four categories:
- Request headers contain information about the resource in question that is being requested. This can include items such as what formats the requesting client can accept, the user agent (browser name and version), also the specific page name or resource ID being requested, or any other specific data that is required for the request to be fulfilled such as a search string, or the clients credentials.
- Response headers contain additional information about the actual response and how it was handled. This generally includes a HTTP Status Code. This might include details about the server that responded to the request, whether a cache was used, and how the client should make further requests. This is also (when appropriate) where any cookies are passed from the server to the client.
- Representation headers contain information about the body of the resource itself, like its type (a webpage, image or video), what language it is in and whether it is compressed.
- Payload headers describe the actual payload, this may include information such as content length and the encoding/ compression method used.
In simplified form (this is tabulated and formatted for clarity), you might expect a request for a search for "today's weather" on Google to look something like:
And the response might look like:
You can of course investigate the actual response headers by making a request for "https://www.google.com/?q=todays+weather" in the Full Header Checker.