From 8ddfcb79656168496b15a3772c437c5cd96637ad Mon Sep 17 00:00:00 2001 From: ajurna Date: Mon, 25 May 2020 18:43:52 +0100 Subject: [PATCH] fix for URL's not working correctly behind a reverse proxy. --- .env.example | 5 ++++- cbreader/settings/base.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 98a6a7b..efe371a 100644 --- a/.env.example +++ b/.env.example @@ -14,4 +14,7 @@ DATABASE_URL = 'postgres://{user}:{password}@{hostname}:{port}/{database-name}' # for google recaptcha 2 # DJANGO_CBREADER_USE_RECAPTCHA = True # DJANGO_RECAPTCHA_PRIVATE_KEY = '' -# DJANGO_RECAPTCHA_PUBLIC_KEY = '' \ No newline at end of file +# DJANGO_RECAPTCHA_PUBLIC_KEY = '' + +# Uncomment the following is using a reverse proxy. +# USE_X_FORWARDED_HOST=True \ No newline at end of file diff --git a/cbreader/settings/base.py b/cbreader/settings/base.py index cd924b3..9c3042e 100644 --- a/cbreader/settings/base.py +++ b/cbreader/settings/base.py @@ -116,4 +116,8 @@ COMIC_DIR = "/media/comics" from .logger import LOGGING -SILK_ENABLED = False \ No newline at end of file +SILK_ENABLED = False + +USE_X_FORWARDED_HOST = os.getenv('USE_X_FORWARDED_HOST', False) == 'True' + +SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')