Feature: add PAPERLESS_COOKIE_SECURE to mark session, CSRF and language cookies Secure (#14886)

This commit is contained in:
Trenton H authored and GitHub committed 2026-11-26 18:53:45 -08:00
1 parent 2b8697e850
commit 89f0037362
2 files changed
+21

No files matched your search

+7
View File
@@ -556,6 +556,13 @@ CSRF_COOKIE_NAME = f"{COOKIE_PREFIX}csrftoken"
SESSION_COOKIE_NAME = f"{COOKIE_PREFIX}sessionid"
LANGUAGE_COOKIE_NAME = f"{COOKIE_PREFIX}django_language"
# Mark the session, CSRF and language cookies as Secure, so browsers only send
# them over HTTPS. Off by default, as it breaks any access over plain HTTP.
COOKIE_SECURE = get_bool_from_env("PAPERLESS_COOKIE_SECURE", "false")
SESSION_COOKIE_SECURE = COOKIE_SECURE
CSRF_COOKIE_SECURE = COOKIE_SECURE
LANGUAGE_COOKIE_SECURE = COOKIE_SECURE
EMAIL_CERTIFICATE_FILE = get_path_from_env("PAPERLESS_EMAIL_CERTIFICATE_LOCATION")
EMAIL_ALLOW_INTERNAL_HOSTS = get_bool_from_env(
"PAPERLESS_EMAIL_ALLOW_INTERNAL_HOSTS",