Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

fixes #122

jonaswinklerb452816a2979
diff --git a/docs/configuration.rst b/docs/configuration.rst
index 2ec34f803..d3f47215b 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -152,6 +152,16 @@ PAPERLESS_AUTO_LOGIN_USERNAME=<username>
Defaults to none, which disables this feature.
+
+PAPERLESS_COOKIE_PREFIX=<str>
+ Specify a prefix that is added to the cookies used by paperless to identify
+ the currently logged in user. This is useful for when you're running two
+ instances of paperless on the same host.
+
+ After changing this, you will have to login again.
+
+ Defaults to ``""``, which does not alter the cookie names.
+
.. _configuration-ocr:
OCR settings
diff --git a/paperless.conf.example b/paperless.conf.example
index 32c0e56b4..910fc22a0 100644
--- a/paperless.conf.example
+++ b/paperless.conf.example
@@ -30,6 +30,7 @@
#PAPERLESS_FORCE_SCRIPT_NAME=
#PAPERLESS_STATIC_URL=/static/
#PAPERLESS_AUTO_LOGIN_USERNAME=
+#PAPERLESS_COOKIE_PREFIX=
# OCR settings
diff --git a/src/paperless/settings.py b/src/paperless/settings.py
index cf0c3e28d..1a6b80a0c 100644
--- a/src/paperless/settings.py
+++ b/src/paperless/settings.py
@@ -210,6 +210,12 @@ AUTH_PASSWORD_VALIDATORS = [
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
+COOKIE_PREFIX = os.getenv("PAPERLESS_COOKIE_PREFIX", "")
+
+CSRF_COOKIE_NAME = f"{COOKIE_PREFIX}csrftoken"
+SESSION_COOKIE_NAME = f"{COOKIE_PREFIX}sessionid"
+LANGUAGE_COOKIE_NAME = f"{COOKIE_PREFIX}django_language"
+
###############################################################################
# Database #
###############################################################################