Socket
Socket
Sign inDemoInstall

django-cookiefilter

Package Overview
Dependencies
1
Maintainers
2
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    django-cookiefilter

Django Cookie Filter


Maintainers
2

Readme

Django_ middleware which removes all unwanted cookies - useful for improving cache hit ratios when analytics cookies interfere with caching.

.. _Django: https://www.djangoproject.com/

Installation

Using pip_:

.. _pip: https://pip.pypa.io/

.. code-block:: console

$ pip install django-cookiefilter

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

.. code-block:: 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:

.. code-block:: python

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

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc