Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix reverse proxy #435

Merged
merged 2 commits into from
Feb 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions bukuserver/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
from flask_api import exceptions, FlaskAPI, status
from flask_bootstrap import Bootstrap
from flask_paginate import Pagination, get_page_parameter, get_per_page_parameter
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
try:
from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix
except ModuleNotFoundError:
ReverseProxyPrefixFix = None
from markupsafe import Markup
import click
import flask
Expand Down Expand Up @@ -236,7 +239,10 @@ def create_app(db_file=None):
if reverse_proxy_path.endswith('/'):
print('Warning: reverse proxy path should not include trailing slash')
app.config['REVERSE_PROXY_PATH'] = reverse_proxy_path
ReverseProxyPrefixFix(app)
if ReverseProxyPrefixFix:
ReverseProxyPrefixFix(app)
else:
raise ModuleNotFoundError('Failed to import ReverseProxyPrefixFix')
bukudb = BukuDb(dbfile=app.config['BUKUSERVER_DB_FILE'])
app.app_context().push()
setattr(flask.g, 'bukudb', bukudb)
Expand Down