Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Implement HSTS to force the use of HTTPS.

Project Description
django-hstsmiddleware
=====================

Forces the use of `HTTPS` using `HTTP Strict Transport Security`
(HSTS).


Installation and Usage
----------------------

Install the package, add ``django_hstsmiddleware`` to
``settings.INSTALLED_APPS``, and add
``django_hstsmiddleware.middleware.HSTSMiddleware`` to the top of
``settings.MIDDLEWARE_CLASSES``.

The following Django settings control its default behaviour:

``settings.HSTS_REDIRECT_TO``:
Specifies the URI to redirect a User Agent to, if it tries
to use a non-secure connection. Responds with HTTP Moved
Permanently.

Defaults to ``None``, so no redirect occurs. Instead, responds
with HTTP Bad Request.

``settings.HSTS_MAX_AGE``:
The maximum number of seconds that a User Agent will remember
that this server must be contacted over HTTPS.

Defaults to ``31536000``, or approximately one year.

``settings.HSTS_INCLUDE_SUBDOMAINS``:
If true, tells a User Agent that all subdomains must also be
contacted over HTTPS, in addition to the current domain.

Defaults to ``False``
Release History

Release History

This version
History Node

1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-hstsmiddleware-1.0.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source Jul 15, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting