What are HTTP headers

HTTP headers are additional pieces of information sent along with a request or response between a client (usually a web browser) and a server. They provide metadata that governs how the requested content is handled, interpreted, and displayed.

We distinguish two categories of HTTP headers: 1) the headers that are sent with the HTTP requests (request headers) and the headers that are sent with the response (response headers).

Request HTTP Headers:

  • User-Agent: Identifies the browser and operating system of the user.
  • Accept: Indicates the media types that the client can process.
  • Cookie: Sends any relevant cookies stored for the domain.
  • Authorization: Includes credentials for accessing restricted resources (if applicable).
  • Referer: Specifies the URL of the previous web page from which the current request originated.

Response HTTP Headers:

  • Content-Type: The Content-Type header informs the client about the media type of the response data. For instance, text/html for HTML documents, application/json for JSON data, etc.
  • Cache-Control: Directs how the content should be cached by the browser or intermediate caches.
  • Content-Encoding: Indicates any compression applied to the response body.
  • Set-Cookie: Instructs the browser to set cookies for future requests.
  • Location: Utilized in redirects, specifying the new URL to which the client should navigate.

Other recommended articles

How to remove “Chrome is being controlled by automated test software” ?

In this article, we present how you can remove the “Chrome is being controlled by automated test software” warning in Chrome using the ignoreDefaultArgs: ["--enable-automation"] argument.

Read more

Published on: 16-06-2024

How to take good screenshots with Puppeteer?

In this article, we present different options of the page.screenshot function in Puppeteer you can use to take good-looking screenshots.

Read more

Published on: 16-06-2024

How to use Puppeteer with the real Google Chrome on Mac ?

In this article, we present how you can use Puppeteer with the real Google Chrome instead of the Chromium browser bundled with Puppeteer using the `executablePath` argument.

Read more

Published on: 16-06-2024