Cookies are a tool used to complement HTTP. They are used by client browsers and websites to maintain some state between HTTP transactions, since HTTP is stateless. They’re commonly used for authorisation, shopping carts, recommendations, and user session state.

There are four components to cookies:

  • A cookie header line of the response message sent by the server. This typically sets the cookie.
  • A cookie header line of the request message sent by the client. This typically has the cookie information, which is checked by the website’s back-end.
  • A cookie file kept on the user’s host, managed by the user’s browser.
  • The back-end database of the website (which manages user info).