Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

http
networks

What is a cookie?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The Hypertext Transfer Protocol (HTTP) is a stateless protocol, i.e., each request must contain all the required information to fulfill the request. The server does not maintain information from prior client requests. However, this is not how the HTTP that we know today works. If it did, then usernames and passwords would have to be shared every time an HTTP request was sent to a website that required authentication.

A cookie is a key-value pair. It is stored on users’ computers by websites to remember notable information. The cookie is shared with the website that ​set it every time the user visits that website. It is important to note that cookies may have an expiration date.

The illustration below shows how a cookie is set and shared:

Alice visits ebay. ebay's server contains an entry for Alice with ID 8890, Alice's browser saves the cookie.
1 of 3

Uses

Some of the most important uses of a cookie are:

  • Storing the contents of users’ shopping carts at online shops.

  • Remembering user preferences on a website to provide a personalized experience for​ each user.

RELATED TAGS

http
networks
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring