Skip to content

Latest commit

 

History

History
80 lines (51 loc) · 2.5 KB

README.rst

File metadata and controls

80 lines (51 loc) · 2.5 KB

Django HTTP Referrer Policy

https://travis-ci.org/DmytroLitvinov/django-http-referrer-policy.svg?branch=master Documentation Status

django-referrer-policy provides a middleware class implementing the Referrer-Policy header for Django-powered sites.

Note: Starting from Django v3.0, Django itself has default support of Referrer-Policy header in SecurityMiddleware via setting variable SECURE_REFERRER_POLICY.

Documentation

The full documentation is at https://django-http-referrer-policy.readthedocs.io.

Quickstart

Install Django HTTP Referrer Policy:

pip install django-http-referrer-policy

Add Django HTTP Referrer Policy Middleware to your settings:

MIDDLEWARE = [
    ...
    'django_http_referrer_policy.middleware.ReferrerPolicyMiddleware',
    ...
]

Optional: provide variable REFERRER_POLICY to your settings with valid value if default value 'no-referrer-when-downgrade' does not suit to you:

REFERRER_POLICY = 'no-referrer'

More details about valid referrer policies: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy#Syntax

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Maintainable version of original library.

Tools used in rendering this package: