diff --git a/app.py b/app.py index 1e14f2b..5d2975f 100644 --- a/app.py +++ b/app.py @@ -12,6 +12,14 @@ app = Flask(__name__) app.logger.propagate = True +try: # pragma: no cover + if settings.APPLY_PROXY_FIX: + # respect X-Forwarded-Proto from proxy server (see #21) + from werkzeug.contrib.fixers import ProxyFix + app.wsgi_app = ProxyFix(app.wsgi_app) +except AttributeError: # pragma: no cover + pass + def parse_slash_command(command): """Parses a slash command for supported arguments. diff --git a/settings.py.example b/settings.py.example index 385a5b1..8fd4886 100644 --- a/settings.py.example +++ b/settings.py.example @@ -24,3 +24,6 @@ MATTERMOST_PA_TOKEN = None # Uncomment the following lines to enable file logging: #import logging #logging.basicConfig(filename='poll.log', level=logging.DEBUG) + +# Needs to be enabled if running behind a proxy server with HTTPS (see issue #21) +APPLY_PROXY_FIX = False