Search⌘ K

What's Behind a Cookie?

Explore the role of HTTP cookies in web applications, including how servers set them and clients send them back. Understand cookie components such as expiration times, domain restrictions, and path limitations to secure cookies effectively during web development.

We'll cover the following...

A server can send a cookie using the Set-Cookie header.

HTTP/1.1 200 Ok
Set-Cookie: access_token=1234
...

A client will then store this data and send it in subsequent requests through the Cookie header.

GET / HTTP/1.1
Host: example.com
Cookie: access_token=1234
...

Note that servers can send multiple cookies at once,

HTTP/1.1 200 Ok
Set-Cookie:
...