HTTP Cookies Flashcards

Get a fucking job

1
Q

How are cookies set?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are cookies?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the HttpOnly flag?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly