Skip to content

Commit

Permalink
Merge pull request #201 from SubstraFoundation/http_settings
Browse files Browse the repository at this point in the history
Secure http settings
  • Loading branch information
jmorel authored Apr 8, 2020
2 parents 45866b5 + 3216563 commit fc257e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions backend/backend/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def to_bool(value):

WSGI_APPLICATION = 'backend.wsgi.application'

SECURE_CONTENT_TYPE_NOSNIFF = True
SESSION_COOKIE_HTTPONLY = True
CSRF_COOKIE_HTTPONLY = True

# Database
# https://docs.djangoproject.com/en/1.9/ref/settings/#databases

Expand Down
4 changes: 4 additions & 0 deletions backend/backend/settings/prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
os.environ['HTTPS'] = "on"
os.environ['wsgi.url_scheme'] = 'https'

SECURE_HSTS_SECONDS = int(os.environ.get('SECURE_HSTS_SECONDS', 365 * 24 * 3600)) # 1 year
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'statics')

Expand Down

0 comments on commit fc257e7

Please sign in to comment.