Member-only story
Cookies At The Edge: Not A Baking Blog Post
4 min readFeb 15, 2022
I came across an interesting use case for edge compute the other day: cookie management at the edge. It probably won’t be super relevant to a ton of people, but it’s an interesting use case I wanted to share, nonetheless.
Brief Background About Cookies
When most people think of cookies, they picture delicious baked morsels. But we’re not here to talk about those (unfortunately). In the context of web development, cookies are one of the options web developers have to store data.
Cookies are awesome. Compared to some of the other options, they have a lot of advantages:
- Unlike storing data in memory, cookies can persist even after the environment is reset. On the frontend, this means they can withstand browser reloads and on the backend they can withstand service restarts or crashes.
- Unlike
localStorage
orsessionStorage
, cookies can be accessed on the server-side. This can allow you to create personalized experiences for users based on their cookies. Cookies can also have anHttpOnly
flag that protects them from Cross-Site Scripting (XSS) attacks. - Unlike a database, cookies can also be access on the client-side (unless they have the attribute). This means there’s no need to make an HTTP request to re-fetch data you may…