---
title: Using Clear-Site-Data header
url: https://calvin.my/posts/using-clear-site-data-header
published: 2025-03-22
updated: 2026-09-16
category: Development
tags:
- Security
- header
summary: The post explains a browser response header that clears locally stored website data, including cookies, storage, and cache, in supported browsers. It can be used after sign-out, account deletion, user-requested resets, or security incidents to remove residual session data. Cookie clearing applies to the target domain and its subdomains, helping applications provide a more reliable way to reset client-side state.
---

# Using Clear-Site-Data header

## Clear-Site-Data Header

`Clear-Site-Data` is a fairly new header. When this header is set, the supported browsers will delete locally stored data associated with the website/domain.

The use cases include:

- When the user signs out
- When the user chooses to delete their account
- Providing a reset button to tackle issues related to cookies (Not all users know how to delete cookies)
- Responding to security incidents,&nbsp; when the user accessing the next time, send this header to force delete all local data

Example:

```ruby
class SessionsController < ApplicationController
  def destroy
    ...
    response.headers['Clear-Site-Data'] = '"cookies", "storage", "cache"'
    redirect_to root_path
  end
end
```

![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/d7900c9c-98e5-4c0d-9a30-74d74beb2fc6.png)

Note: Clearing cookies is effective for the target domain and all its sub-domains.

* * *

## Reference

[https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Clear-Site-Data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Clear-Site-Data)
