Add trust-x-forwarded-proto settings

This commit is contained in:
Raphael Michel
2019-12-14 13:37:25 +01:00
parent 529e2a0286
commit 018d345008
4 changed files with 12 additions and 0 deletions

View File

@@ -90,6 +90,11 @@ Example::
proxy that actively removes and re-adds the header to make sure the correct client IP is the first value. proxy that actively removes and re-adds the header to make sure the correct client IP is the first value.
Defaults to ``off``. Defaults to ``off``.
``trust_x_forwarded_proto``
Specifies whether the ``X-Forwarded-Proto`` header can be trusted. Only set to ``on`` if you have a reverse
proxy that actively removes and re-adds the header to make sure the correct client IP is the first value.
Defaults to ``off``.
Locale settings Locale settings
--------------- ---------------

View File

@@ -125,6 +125,8 @@ Fill the configuration file ``/etc/pretix/pretix.cfg`` with the following conten
; DO NOT change the following value, it has to be set to the location of the ; DO NOT change the following value, it has to be set to the location of the
; directory *inside* the docker container ; directory *inside* the docker container
datadir=/data datadir=/data
trust_x_forwarded_for=on
trust_x_forwarded_proto=on
[database] [database]
; Replace postgresql with mysql for MySQL ; Replace postgresql with mysql for MySQL

View File

@@ -85,6 +85,8 @@ Fill the configuration file ``/etc/pretix/pretix.cfg`` with the following conten
url=https://pretix.mydomain.com url=https://pretix.mydomain.com
currency=EUR currency=EUR
datadir=/var/pretix/data datadir=/var/pretix/data
trust_x_forwarded_for=on
trust_x_forwarded_proto=on
[database] [database]
; For MySQL, replace with "mysql" ; For MySQL, replace with "mysql"

View File

@@ -134,6 +134,9 @@ CSRF_TRUSTED_ORIGINS = [urlparse(SITE_URL).hostname]
TRUST_X_FORWARDED_FOR = config.get('pretix', 'trust_x_forwarded_for', fallback=False) TRUST_X_FORWARDED_FOR = config.get('pretix', 'trust_x_forwarded_for', fallback=False)
if config.get('pretix', 'trust_x_forwarded_proto', fallback=False):
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
PRETIX_PLUGINS_DEFAULT = config.get('pretix', 'plugins_default', PRETIX_PLUGINS_DEFAULT = config.get('pretix', 'plugins_default',
fallback='pretix.plugins.sendmail,pretix.plugins.statistics,pretix.plugins.checkinlists,pretix.plugins.autocheckin') fallback='pretix.plugins.sendmail,pretix.plugins.statistics,pretix.plugins.checkinlists,pretix.plugins.autocheckin')
PRETIX_PLUGINS_EXCLUDE = config.get('pretix', 'plugins_exclude', fallback='').split(',') PRETIX_PLUGINS_EXCLUDE = config.get('pretix', 'plugins_exclude', fallback='').split(',')