Clear-Site-Data: wiping browser state on logout
Clear-Site-Data instructs the browser to delete data it holds for your origin. It is meant for logout and account switch responses, where leftover state is a real hazard.
At a glance
- Direction
- Response only, and browsers only honour it over a secure connection.
- Defined in
- Clear Site Data (W3C)
- When absent
- Nothing is cleared. Cookies survive until they expire and local storage survives indefinitely.
- Directives
- Quoted tokens: "cache", "cookies", "storage", "executionContexts" and "*"
- Requires
- A secure context. It is ignored on plain HTTP.
- Scope
- The origin of the response, not the whole registrable domain
- Support
- Uneven for "cache" in particular, so treat clearing as best effort.
In detail
The value is a comma separated list of quoted tokens, each naming a category the browser should discard for the response origin. The cookies token removes cookies and HTTP authentication credentials, storage covers local storage, session storage, IndexedDB and service worker registrations, cache covers the HTTP cache, and executionContexts asks the browser to reload open tabs for that origin.
The realistic use is logout. On a shared machine a session cookie disappearing is not enough: a single page application usually has cached user data in local storage and a service worker holding responses fetched while signed in. Sending the header on the logout response clears all of it in one step, instead of relying on client side cleanup that only runs while the tab is still open.
It is also useful after an incident. If tokens leaked into storage, or a service worker shipped a bad cached shell, a response carrying this header on the next visit is the only reliable way to invalidate what is already on the visitor's machine, because there is no other way to reach into a browser.
Treat it as best effort. The tokens are honoured unevenly across browsers, cache in particular, and nothing reports back what was actually cleared, because the browser sends no acknowledgement of any kind. Application logic should still handle a stale value gracefully rather than assuming storage is empty afterwards, and a shared machine warning in the interface is worth more than a header nobody can verify ran.
Examples
HTTP/1.1 302 Found
Location: /signed-out
Clear-Site-Data: "cookies", "storage"Clear-Site-Data: "*"The star token also covers executionContexts, so open tabs for the origin are reloaded.
Things that catch people out
- The tokens must be quoted. Clear-Site-Data: cookies without quotation marks is invalid and is ignored.
- Sending "storage" unregisters service workers, so a site relying on one for offline support loses it and installs it again on the next visit.
- It clears data for the response origin only. A logout on the main site does not clear anything held by an authentication subdomain unless that subdomain sends its own header.
Try it: HTTP Headers Checker
Check a live URL or paste headers you already have. It grades six security headers from A+ to F and lists every other header the response returned.
HTTP Headers Checker
LOCAL · Browser-OnlyView HTTP response headers for any URL
Enter any website URL to fetch and analyze its HTTP response headers. We'll automatically add https:// if needed.
Why Check Security Headers?
Security headers protect your website against common attacks like XSS, clickjacking, and MIME sniffing. They're set by your web server and cost nothing to implement. Missing security headers are one of the most common findings in security audits.
Related HTTP headers
All http headers →Set-Cookie: attributes, SameSite and cookie prefixes
Every Set-Cookie attribute explained, why SameSite=None needs Secure, what the __Host- prefix guarantees, and how Max-Age and Expires interact.
Cookie: what the browser sends back
How the Cookie header is formatted, why attributes never come back, how the browser decides which cookies to include, and what the size limits are.
Cache-Control: directives for browsers and shared caches
Every Cache-Control directive that matters, the difference between no-cache and no-store, and how to cache immutable assets forever without breaking deploys.
Strict-Transport-Security: the HSTS response header
What Strict-Transport-Security does, what max-age and includeSubDomains change, why preload is close to permanent, and how to withdraw the policy safely.
Reporting-Endpoints: where browser reports are sent
How Reporting-Endpoints names collectors for CSP violations and deprecation warnings, how it differs from the older Report-To header, and what arrives.
Sec-Fetch-Site and the Fetch Metadata request headers
What the browser tells your server about where a request came from and what it is for, and how to use Fetch Metadata headers to reject cross-site requests.
Tools for this
- HTTP Headers Checker Free online HTTP headers checker - view HTTP response headers for any URL
- HTTP Request Builder Free online HTTP request builder - build and test HTTP requests with custom headers and body