What does the HttpOnly flag do?
Set-Cookie: sid=abc; HttpOnly; Secure; SameSite=Strict
- Hides the cookie from JavaScript
- Sends the cookie over HTTP only
- Expires the cookie on logout
- Encrypts the cookie's value
HttpOnly blocks document.cookie access, so stolen XSS cannot read the session.
Play Cybersecurity ▸