skip to navigation
skip to content

django-sslify-admin 0.3

Force SSL on your Django admin site.

Latest Version: 0.5.0


Force SSL on your Django admin site


To install django-sslify-admin, simply run pip install django-sslify-admin and you’ll get the latest version installed automatically.


Modify your Django file, and prepend sslifyadmin.middleware.SSLifyAdminMiddleware to your MIDDLEWARE_CLASSES setting:

    # ...

NOTE: Make sure sslify.middleware.SSLifyMiddleware is the first middleware class listed, as this will ensure that if a user makes an unsecure request (over HTTP), they will be redirected to HTTPs before any actual processing happens.

Custom admin url?

If you are using a custom admin url, you have to set SSLIFY_ADMIN_NAMESPACE in your

# SSLIFY_ADMIN_NAMESPACE = "admin" # default
SSLIFY_ADMIN_NAMESPACE = "myadminurl" # custom

Behind a Proxy? (Heroku)

If your Django app is behind a proxy (like Heroku), though, the proxy may be “swallowing” the fact that a request is HTTPS, using a non-HTTPS connection between the proxy and Django.

In this situation, you’ll want to configure the proxy (Heroku already does that for you) to set a custom HTTP header that tells Django whether the request came in via HTTPS, and you’ll want to set `SECURE_PROXY_SSL_HEADER so that Django knows what header to look for, like this:



This code was taken and modified from this StackOverflow thread. This Project is also influenced by Randall Degges django-sslify, use this, if you want to secure your whole site, and not only the admin interface of Django.


$ git clone
$ cd django-sslify-admin
$ python develop
$ python test
Creating test database for alias 'default'...
Ran 2 tests in 0.003s

Destroying test database for alias 'default'...
File Type Py Version Uploaded on Size
django-sslify-admin-0.3.tar.gz (md5) Source 2014-02-06 3KB