Cookies
why the word cookie?
Cookie is a concept that came from the old Unix world, where the term "magic cookie" was used to refer to a token or a piece of opaque data that's passed between programs.
This is exactly what the cookies in browsers are. They receive a small piece of data from the server and then it sends it back to the server with every request blindly.
Cookies are set via the set-cookie header in the response from the server. This is a browser standard which reads the values in this header and by default send it back in the further requests sent to the same server.
Which cookies are sent to whom?
The domain name in the cookie header is the decider. For any requests that goes from the browser to that domain name and path will have the corresponding cookies attached to it.
Types of cookies
- Session Cookies - These are cookies used by server to maintain user sessions. See sessions for more details.
- Tracking Cookies - These are cookies set and used by advertisers or any third party to track user behavior across websites.
