What you can check about a cookie
A cookie might store a language preference or a reference to a login session held on the server. Its name alone cannot reliably establish either its content or its role in authentication. First identify which component sets it and what the application uses it for.
A Set-Cookie header shows what the server sends to the browser. Whether the browser accepts the cookie, how long it retains it and which later requests include it are separate questions. Additional browser rules and user settings may restrict storage or sending. MDN: using cookies
The Web Security Check analyses cookie attributes in the observed Set-Cookie headers of a retrieved response. It does not log in, cover every path, inspect cookies subsequently set through JavaScript or examine the browser's entire cookie store. A cookie that was not observed is therefore confirmed neither absent nor secure. An individual finding can still answer your first configuration question.
Secure, HttpOnly and SameSite serve different purposes
On narrow screens, scroll the table sideways.
| Attribute | What it restricts | What this does not establish |
|---|---|---|
Secure | The browser sends the cookie only over a channel it treats as secure, normally HTTPS for public web addresses. | Protection against every form of tampering, compromised endpoints or an insecure application. |
HttpOnly | Non-HTTP cookie APIs such as document.cookie cannot read the cookie. | It does not stop injected JavaScript from triggering browser requests that automatically include applicable cookies. |
SameSite | The browser restricts sending the cookie according to the site context and selected value. | A general block on all cross-site requests or complete CSRF protection. |
Some browsers treat local development addresses specially for Secure. Such exceptions are not a basis for a public HTTP configuration. For production web applications, HTTPS delivery, including any proxies in front of the application, must match the cookie configuration. MDN: Set-Cookie
For a session cookie used on the server and bound to a single host, the following combination may be suitable:
Set-Cookie: __Host-session=abc123; Path=/; Secure; HttpOnly; SameSite=LaxThe value is fictional and the example has not been tested in practice. It assumes HTTPS, a supporting browser and a flow that works with Lax. In addition to being set securely, __Host- requires an explicit Path=/ and prohibits a Domain attribute. The prefix replaces neither HttpOnly nor a deliberate choice of SameSite. In supporting browsers, the less restrictive __Secure- also requires secure setting with Secure, but imposes no additional host/path restrictions like __Host-. These prefixes do not provide general protection against cookie jar overflow.
Distinguish site, host and path
For ordinary HTTP(S) addresses, ‘same-site’ is based on the scheme and registrable domain. This boundary cannot always be identified from the last dot in a name alone: the Public Suffix List also accounts for certain hosting services.
https://app.example.com and https://api.example.com are same-site but have different origins. An origin is defined by scheme, host and port. Switching from HTTPS to HTTP can therefore be cross-site, whereas a different port with the same scheme and registrable domain does not change the site. SameSite thus does not generally exclude a compromised sibling domain. web.dev: same-site and same-origin
On narrow screens, scroll the table sideways.
| Setting | Effect on sending |
|---|---|
No Domain attribute | Host-only: the cookie is bound to the host that set it. |
Domain=example.com | The scope includes this domain and matching subdomains. The host setting the cookie cannot select an arbitrary unrelated domain. |
Path=/account | The request path must match the cookie path: for example, /account/settings matches, whereas /accounting does not. |
Path=/ | The cookie can be considered for matching requests to every path on this host or within its domain scope. |
Path is not a reliable security boundary between applications on the same host. Domain and path also help determine which existing cookie you modify or delete. RFC 6265: Domain and Path
Choose SameSite and understand its CSRF limitations
Cross-Site Request Forgery exploits, among other things, the browser's ability to attach existing credentials to a request triggered from elsewhere. Whether an application then performs an action also depends on its authentication, authorisation and CSRF checks.
The following table describes only the SameSite condition. It assumes the cookie is already stored, the domain and path match, and no other browser rule prevents it from being sent.
On narrow screens, scroll the table sideways.
| Request context | SameSite=Strict | Explicit SameSite=Lax | SameSite=None; Secure |
|---|---|---|---|
| Same-site request | SameSite allows sending. | SameSite allows sending. | SameSite allows sending. |
| Cross-site top-level navigation using a safe HTTP method, such as GET | The cookie is withheld. | SameSite allows sending. | SameSite allows sending. |
| Cross-site POST, for example through a form | The cookie is withheld. | The cookie is withheld. | SameSite does not prevent sending. |
| Cross-site request for an embedded resource | The cookie is withheld. | The cookie is withheld. | SameSite does not prevent sending. |
‘Safe HTTP method’ is a protocol term, not a judgement about your application's security. State changes do not belong in a GET request. Even with Lax, additional CSRF countermeasures remain necessary. An absent SameSite attribute is not equivalent to None: browsers may apply a Lax default; a less restrictive variant may allow certain top-level POST requests for recently set cookies. Do not rely on this transitional behaviour. 6265bis-22: SameSite processing
This distinction matters for login, payment and embedding flows. When following an external link, a Strict cookie is not sent on the first cross-site navigation. That does not automatically mean the server-side session has ended or the user must sign in again. None; Secure may be suitable for deliberately required cross-site functions, but does not override browser restrictions on third-party cookies.
Synthetic model case · not a measurement
What SameSite restricts in this POST
Triggers a cross-site request.
The request itself can arrive in both cases.
Assumptions: the cookie is stored, the domain and path match, and no other browser rule prevents sending.
SameSite=None; Secure- SameSite does not prevent the cookie from being included.
SameSite=Strict- SameSite withholds the cookie.
The application then decides: authentication, authorisation and CSRF checks remain necessary.
No evidence of a completed transaction and no general promise of protection against attacks.
Check lifetime and logout separately
Max-Age specifies a lifetime in seconds; Expires specifies a point in time. If both are present, Max-Age takes precedence. A browser may remove a cookie earlier, for example because of its storage policies or a user action.
If neither is present, this is a session cookie in terms of browser storage. The browser determines when a browsing session ends; session restore may reuse cookies after a restart. A ‘Session’ entry therefore proves neither a guaranteed deletion time nor a valid login.
To remove a cookie, the application must match its name, domain/host binding and path, for example using Max-Age=0. Logout must also invalidate the application session on the server. Deleting the cookie in the browser alone does not invalidate a session identifier that has already been copied. MDN: removing cookies, OWASP: session management
Work through configuration in three steps
1. Identify the required flow and responsible component
Record the cookie's purpose, the application setting it, the required hosts/paths, lifetime and JavaScript access. Pay particular attention to external sign-in, payment redirects and embedded content. A session cookie used on the server can receive HttpOnly; a preferences cookie intentionally read by JavaScript needs a different decision.
Set attributes where the cookie originates wherever possible. A reverse proxy can add attributes to upstream cookies, but does not automatically know their purpose in the application.
2. Set targeted cookie options
The following Nginx fragment modifies the cookie named session set by the upstream. It requires proxy_cookie_flags, available from Nginx 1.19.3, and an appropriate proxy context:
location / {
proxy_pass http://backend;
proxy_cookie_flags session secure httponly samesite=lax;
}backend is a placeholder for your configured upstream. This fragment has not been run. It changes neither the cookie name nor, automatically, its Domain, Path or lifetime, and does not cover cookies created later in the browser. Where several rules apply, the first matching rule is used; also check inherited configuration. Do not apply a SameSite rule to all cookies without checking their requirements. Nginx: proxy_cookie_flags
For an already configured express-session middleware, the following options can be supplied as the cookie option:
const cookieOptions = {
secure: true,
httpOnly: true,
sameSite: 'lax',
path: '/',
};This is only the cookie options object, not a complete Express application. It does not include the secret, session store or remaining middleware configuration. With secure: true, the application must recognise the request as HTTPS. Behind a reverse proxy, the trust configuration must match the actual setup; indiscriminate proxy trust is not a safe default. This example has not been tested in practice either. Express: express-session
3. Check the response and browser flow again
For an initial look at the headers of a GET response, you could use the following on a target you are authorised to examine:
curl -sS -D - -o /dev/null https://example.com/loginThe address is a placeholder. This command has not been run; it does not log in, follow redirects or reproduce browser cookie rules. A HEAD request using -I is a different request, and its response need not set the same cookies. Check the response that actually creates the relevant cookie, for example after an authorised login. curl: documented options
Then inspect the stored attributes, blocking reasons and cookies on a later request in the browser. Also compare logout and the affected external flows.
Document a technical finding clearly
Record the cookie's purpose, the flow examined, browser context, observed attributes, open questions and follow-up checks. Session values do not belong in public handover documentation. The attributes can support technical safeguards; they establish neither complete security nor lawfulness or GDPR compliance.
Whether requirements under PCI DSS, NIS2 or other rules apply in a particular case, and which ones, needs separate assessment. A cookie check is not complete evidence for that assessment. Technical settings alone cannot determine, in particular, whether a cookie requires consent.
Further checks and configuration guidance
If checking a public response can answer your next question, you can open the Web Security Check. The login and browser checks described above remain a separate step.
Frequently asked questions
What do the main cookie attributes do?
Secure restricts transmission to secure connections. HttpOnly prevents reading through non-HTTP cookie APIs. SameSite restricts sending in certain site contexts. These mechanisms reduce specific risks; they do not prevent every form of XSS, CSRF or session hijacking. The choice depends on the cookie's purpose.
What is the difference between SameSite=Strict and SameSite=Lax?
Strict withholds cookies on cross-site requests. Explicit Lax additionally allows cross-site top-level navigation using safe HTTP methods such as GET. Login, payment and embedding flows must be compatible with this. SameSite does not replace all CSRF countermeasures.
Does HttpOnly prevent the effects of XSS?
HttpOnly prevents the cookie from being read directly through APIs such as document.cookie. Injected JavaScript can still trigger requests in the signed-in user's browser. XSS must be prevented independently of cookie attributes.
What conditions does __Host- require?
A supporting browser requires the cookie to be set securely, Secure, an explicit Path=/ and no Domain attribute. A computed default path of / is insufficient. The prefix sets neither HttpOnly nor a suitable SameSite value for you.
What does the Web Security Check examine about cookies?
It analyses observed Set-Cookie headers in the response retrieved. It does not cover login, other paths, later JavaScript cookies or the browser's entire cookie store. Classification as a session cookie based on its name is an indication, not evidence of an actual login flow.
Do suitable cookie attributes demonstrate legal compliance?
No. The attributes can support technical safeguards, but establish neither lawful processing nor complete security. Purpose, content, actual use and further requirements need separate assessment.
Sources and technical status
- RFC 6265: published Proposed Standard for HTTP cookies.
- 6265bis-22: the draft revision used here for the SameSite and prefix rules. At the source review on 12 September 2026, it was in the RFC Editor process and was not yet a published RFC.
- MDN Set-Cookie and using cookies: attributes and browser limitations.
- OWASP session management: session control and complementary safeguards.
- Nginx proxy module and express-session: prerequisites for the configuration fragments shown.
Source review: 12 September 2026. The examples explain documented rules; they are not configurations tested in practice.