2

I have a working django install with django-sslify and it correctly HTTPS my urls but with inconsistent behaviour.

For example, if I type socialspark.spuro.org it takes me to an HTTP page. If I type socialspark.spuro.org/something it takes me to an HTTPS page.

Of course, if I type https://socialspark.spuro.org/ it will take me to an HTTPS page.

It's concerning for me that with one misspelling, all my HTTPS support will be gone. What should I do to remedy this issue?

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
tsurantino
  • 1,027
  • 13
  • 27

1 Answers1

2

Take a look at django-secure, it's got middleware that can do this for you. After you installed it you can put this in your settings.py:

SECURE_SSL_REDIRECT = True

However if you have the access, you could also do this in the webserver (Nginx, Apache). That will be much faster.

gitaarik
  • 42,736
  • 12
  • 98
  • 105