Metadata-Version: 2.4
Name: django-cookiefilter
Version: 1.1
Summary: Django Cookie Filter
Maintainer-email: The Developer Society <studio@dev.ngo>
License-Expression: BSD-3-Clause
Project-URL: Homepage, https://github.com/developersociety/django-cookiefilter
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Django Cookie Filter

[Django](https://www.djangoproject.com/) middleware which removes all unwanted cookies - useful
for improving cache hit ratios when analytics cookies interfere with caching.

## Installation

Using [pip](https://pip.pypa.io/):

```console
$ pip install django-cookiefilter
```

Edit your Django project's settings module, and add the middleware to the start of ``MIDDLEWARE``:

```python
MIDDLEWARE = [
    "cookiefilter.middleware.CookieFilterMiddleware",
    # ...
]
```

> [!NOTE]
> The middleware should be added before ``UpdateCacheMiddleware``, as it uses the value of
> HTTP_COOKIES which needs to be modified.

## Configuration

Out of the box the standard Django cookie names will work without any other configuration. However
if your project uses different or additional cookie names, edit ``COOKIEFILTER_ALLOWED`` in your
project's settings module:

```python
COOKIEFILTER_ALLOWED = [
    "analytics",
    "csrftoken",
    "django_language",
    "messages",
    "sessionid",
]
```
