Using Cookies to Associate Transactions

If each HTTP request includes an identifier that is unique to the Web client sending the request, association between subsequent requests from the same Web client is intuitive. This is exactly what cookies are intended to achieve.

Although cookies are most often described in conversation as if they are entities (for example, “a Web server sends you a cookie”), they are much easier to understand at a functional level if you consider them an extension of the HTTP protocol, which is actually more correct. Cookies can be defined as the addition of two HTTP headers:

  • Set-Cookie response header

  • Cookie request header

Note

Cookies are defined in RFC 2109, “HTTP State Management Mechanism.” Although a newer specification ...

Get HTTP Developer’s Handbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.