Add enforce host
This commit is contained in:
parent
5ec613f7bb
commit
6f6e57a0c7
2 changed files with 5 additions and 0 deletions
|
@ -28,6 +28,7 @@ django3-cache-decorator==0.5.2
|
|||
django-cors-headers==3.13.0
|
||||
django-csp==3.7
|
||||
django-permissions-policy==4.13.0
|
||||
django-enforce-host==1.1.0
|
||||
|
||||
# DRF OpenAPI dependencies
|
||||
uritemplate
|
||||
|
|
|
@ -94,6 +94,7 @@ MIDDLEWARE = [
|
|||
"django.middleware.security.SecurityMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
"corsheaders.middleware.CorsMiddleware",
|
||||
"enforce_host.EnforceHostMiddleware",
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
|
@ -421,6 +422,9 @@ if not DEBUG:
|
|||
CSP_BLOCK_ALL_MIXED_CONTENT = True
|
||||
CSP_UPGRADE_INSECURE_REQUESTS = True
|
||||
|
||||
if not TEST:
|
||||
ENFORCE_HOST = BASE_HOSTNAME
|
||||
|
||||
if sentry_dsn := env("SENTRY_DSN"):
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
|
|
Loading…
Reference in a new issue