Skip to content
Snippets Groups Projects
Unverified Commit c57f1ac6 authored by Marco Ciotola's avatar Marco Ciotola
Browse files

[DJ2] Update HSTS Middleware to latest definition

parent c36f0a99
Branches
No related tags found
No related merge requests found
......@@ -22,7 +22,19 @@ import helios
class HSTSMiddleware:
def process_response(self, request, response):
def __init__(self, get_response):
self.get_response = get_response
# One-time configuration and initialization.
def __call__(self, request):
# Code to be executed for each request before
# the view (and later middleware) are called.
response = self.get_response(request)
# Code to be executed for each request/response after
# the view is called.
if settings.STS:
response['Strict-Transport-Security'] = "max-age=31536000; includeSubDomains; preload"
return response
......
......@@ -116,19 +116,20 @@ SECURE_CONTENT_TYPE_NOSNIFF = True
SILENCED_SYSTEM_CHECKS = ['urls.W002']
MIDDLEWARE_CLASSES = (
MIDDLEWARE = [
# make all things SSL
#'sslify.middleware.SSLifyMiddleware',
# secure a bunch of things
'djangosecure.middleware.SecurityMiddleware',
'django.middleware.security.SecurityMiddleware',
'helios.security.HSTSMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
# 'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware'
)
'django.contrib.auth.middleware.AuthenticationMiddleware',
]
ROOT_URLCONF = 'urls'
......@@ -280,7 +281,7 @@ CELERY_TASK_ALWAYS_EAGER = True
ROLLBAR_ACCESS_TOKEN = get_from_env('ROLLBAR_ACCESS_TOKEN', None)
if ROLLBAR_ACCESS_TOKEN:
print "setting up rollbar"
MIDDLEWARE_CLASSES += ('rollbar.contrib.django.middleware.RollbarNotifierMiddleware',)
MIDDLEWARE += ['rollbar.contrib.django.middleware.RollbarNotifierMiddleware',]
ROLLBAR = {
'access_token': ROLLBAR_ACCESS_TOKEN,
'environment': 'development' if DEBUG else 'production',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment