HTTP Cookies Flashcards
Get a fucking job
How are cookies set?
Server-side through HTTP headers. When a server responds to an HTTP request, it can include a Set-Cookie header.
Clien-side through JavaScript, using the document.cookie API.
What are cookies?
They’re small pieces of data stored by websites in the browser. They’re key-value pairs that let websites “remember” information between requests.
Along with the values, cookies can have several attributes: Domain, Path, Expires or Max-Age, Secure, HttpOnly, SameSite.
Common uses: session management, preferences and tracking.
Cookies are sent on each request through the Cookie header.
What is the HttpOnly flag?
When a cookie is set with the HttpOnly flag, it won’t by accessible by JavaScript in the client side.
The server can read or set HttpOnly cookies.