From: Florian Brandes Date: Tue, 12 Apr 2022 12:39:08 +0000 (+0200) Subject: add "localhost" to ALLOWED_HOSTS X-Git-Tag: ngx-1.7.0~1^2~20^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F700%2Fhead;p=thirdparty%2Fpaperless-ngx.git add "localhost" to ALLOWED_HOSTS if PAPERLESS_URL is set and ALLOWED_HOSTS is NOT set Signed-off-by: Florian Brandes --- diff --git a/docs/configuration.rst b/docs/configuration.rst index 3541f2e07d..c1f27c5d47 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -170,6 +170,9 @@ PAPERLESS_ALLOWED_HOSTS= Can also be set using PAPERLESS_URL (see above). + If manually set, please remember to include "localhost". Otherwise docker + healthcheck will fail. + Defaults to "*", which is all hosts. PAPERLESS_CORS_ALLOWED_HOSTS= diff --git a/src/paperless/settings.py b/src/paperless/settings.py index b267ee10f0..e720a69467 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -251,7 +251,8 @@ if _paperless_url: if _allowed_hosts: ALLOWED_HOSTS.append(_paperless_uri.hostname) else: - ALLOWED_HOSTS = [_paperless_uri.hostname] + # always allow localhost. Necessary e.g. for healthcheck in docker. + ALLOWED_HOSTS = [_paperless_uri.hostname] + ["localhost"] # The secret key has a default that should be fine so long as you're hosting # Paperless on a closed network. However, if you're putting this anywhere