Skip to content

Commit b13a606

Browse files
feat: recognize HTTPS via proxy (ietf-tools#7765)
* feat: set SECURE_PROXY_SSL_HEADER * chore: update comment
1 parent 0b445a9 commit b13a606

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

k8s/settings_local.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ def _multiline_to_list(s):
1717
# Default to "development". Production _must_ set DATATRACKER_SERVER_MODE="production" in the env!
1818
SERVER_MODE = os.environ.get("DATATRACKER_SERVER_MODE", "development")
1919

20+
# Use X-Forwarded-Proto to determine request.is_secure(). This relies on CloudFlare overwriting the
21+
# value of the header if an incoming request sets it, which it does:
22+
# https://developers.cloudflare.com/fundamentals/reference/http-request-headers/#x-forwarded-proto
23+
# See also, especially the warnings:
24+
# https://docs.djangoproject.com/en/dev/ref/settings/#secure-proxy-ssl-header
25+
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
26+
2027
# Secrets
2128
_SECRET_KEY = os.environ.get("DATATRACKER_DJANGO_SECRET_KEY", None)
2229
if _SECRET_KEY is not None:

0 commit comments

Comments
 (0)