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-cors-headers==3.13.0
|
||||||
django-csp==3.7
|
django-csp==3.7
|
||||||
django-permissions-policy==4.13.0
|
django-permissions-policy==4.13.0
|
||||||
|
django-enforce-host==1.1.0
|
||||||
|
|
||||||
# DRF OpenAPI dependencies
|
# DRF OpenAPI dependencies
|
||||||
uritemplate
|
uritemplate
|
||||||
|
|
|
@ -94,6 +94,7 @@ MIDDLEWARE = [
|
||||||
"django.middleware.security.SecurityMiddleware",
|
"django.middleware.security.SecurityMiddleware",
|
||||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||||
"corsheaders.middleware.CorsMiddleware",
|
"corsheaders.middleware.CorsMiddleware",
|
||||||
|
"enforce_host.EnforceHostMiddleware",
|
||||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||||
"django.middleware.common.CommonMiddleware",
|
"django.middleware.common.CommonMiddleware",
|
||||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||||
|
@ -421,6 +422,9 @@ if not DEBUG:
|
||||||
CSP_BLOCK_ALL_MIXED_CONTENT = True
|
CSP_BLOCK_ALL_MIXED_CONTENT = True
|
||||||
CSP_UPGRADE_INSECURE_REQUESTS = True
|
CSP_UPGRADE_INSECURE_REQUESTS = True
|
||||||
|
|
||||||
|
if not TEST:
|
||||||
|
ENFORCE_HOST = BASE_HOSTNAME
|
||||||
|
|
||||||
if sentry_dsn := env("SENTRY_DSN"):
|
if sentry_dsn := env("SENTRY_DSN"):
|
||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
from sentry_sdk.integrations.django import DjangoIntegration
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
|
|
Loading…
Reference in a new issue