Skip to content

Commit

Permalink
Add setting to apply ProxyFix (closes #21)
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Mueller authored Dec 2, 2018
1 parent 15dad44 commit 3bee011
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions settings.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3bee011

Please sign in to comment.