Skip to main content

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

Project description

https://badge.fury.io/py/django-http-referrer-policy.svg https://travis-ci.org/DmytroLitvinov/django-http-referrer-policy.svg?branch=master Documentation Status https://codecov.io/gh/DmytroLitvinov/django-http-referrer-policy/branch/master/graph/badge.svg

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:

History

1.1.1 (2020-11-02)

  • Add deprecation warning about Django v3.0. Django itself has default support of Referrer-Policy header in SecurityMiddleware via setting variable SECURE_REFERRER_POLICY.

1.1.0 (2020-10-27)

  • Set default value to 'no-referrer-when-downgrade' instead of requiring it

  • Add Django 3.1 and Python 3.9 for testing

1.0.1 (2019-08-23)

  • Update setup.py

  • Update docs for setting value in django-settings.

1.0.0 (2019-08-11)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-http-referrer-policy-1.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

django_http_referrer_policy-1.1.1-py2.py3-none-any.whl (5.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-http-referrer-policy-1.1.1.tar.gz.

File metadata

File hashes

Hashes for django-http-referrer-policy-1.1.1.tar.gz
Algorithm Hash digest
SHA256 917f5ed62054b27eff3172b7eccfb018469e85ddd538767328553282a70493c3
MD5 9cf8957357c1e52db3f7971fd4fcab8e
BLAKE2b-256 c42a31a94b1f634a8843a3e879fbb988a3ebbff7927face4768249dff8059198

See more details on using hashes here.

File details

Details for the file django_http_referrer_policy-1.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_http_referrer_policy-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7617d1256f1ab80c1a12bffdd8c8d24b94093eb1e21d035e2aa6d7d3c5ac999e
MD5 34d6de4ed333da1850c4f7ca8838c1ef
BLAKE2b-256 368e1e8b96d8c9722d87d71a8542d7d2dfde6816cb15693e67e40208e0f76bd3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page