Skip to main content

A middleware that secures URLS.

Project description

Django SSL Redirect

Django SSL Redirect is a middleware that ensures secured URLs and only secured URLs are accessed securely over HTTPS.


Run `pip install django-ssl-redirect`

Add `ssl_redirect.middleware.SSLRedirectMiddleware` to the top of your MIDDLEWARE_CLASSES setting:


Securing Views
To secure a view simply add `'SSL': True` the views kwargs

urlpatterns = patterns('my_app.views',
url(r'^secure/path/$', 'secure_view', {'SSL':True}),

You can always ensure a view is not served over SSL with `'SSL': True`

urlpatterns = patterns('my_app.views',
url(r'^unsecure/path/$', 'secure_view', {'SSL': False}),

`SSL_ON (default True)`
Use SSL redirects. This setting overrides all other settings.

`SSL_ALWAYS (default False)`
Use SSL throughout the entire site.

`HTTPS_PATHS (default [])`
A list of secure paths.

`SSL_PORT (default None)`
Port number of the SSL connection. If the value is not None it will be appended after the host.

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-ssl-redirect-2.1.1.tar.gz (3.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page