This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.http import HttpResponsePermanentRedirect, get_host | |
class ForceSSLMiddleware(object): | |
""" | |
Redirects all (non-DEBUG) requests to go through SSL. | |
Picks up the `HTTP_X_FORWARDED_PROTO` proxy header set by Heroku. | |
Also sets the "Strict-Transport-Security" header for 600 seconds so that |