From 9cccd46b41ba004526b9e0cdf80b2b4bda7ff642 Mon Sep 17 00:00:00 2001 From: Benjamin Bengfort Date: Wed, 23 Nov 2022 06:51:54 -0600 Subject: [PATCH] fix tls proxy and ga4 --- templates/components/analytics.html | 8 ++++---- webfolio/settings/production.py | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/templates/components/analytics.html b/templates/components/analytics.html index 7b1823c..42280b4 100644 --- a/templates/components/analytics.html +++ b/templates/components/analytics.html @@ -1,9 +1,9 @@ - - + + \ No newline at end of file diff --git a/webfolio/settings/production.py b/webfolio/settings/production.py index e7723ef..7f63c95 100644 --- a/webfolio/settings/production.py +++ b/webfolio/settings/production.py @@ -41,6 +41,11 @@ ## SSL is terminated at Traefik so all requests will be http in the k8s cluster. SECURE_SSL_REDIRECT = False +## Ensure that the Traefik proxy causes Django to act like its behind TLS +SOCIAL_AUTH_REDIRECT_IS_HTTPS = True +USE_X_FORWARDED_HOST = True +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') + ## Static files served by WhiteNoise STATIC_ROOT = os.path.join(PROJECT, 'staticfiles') STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'