Commit 4ff28c14 authored by Emanuele Aina's avatar Emanuele Aina

Actually fix HTTPS detection behind proxies

The previous commit, 75b6f9ca, used the werkzeug 0.15 code pattern, but
Debian only ships 0.14 at the moment.

Switch to the 0.14 approach for the time being.
Signed-off-by: Emanuele Aina's avatarEmanuele Aina <emanuele.aina@collabora.com>
parent 75b6f9ca
Pipeline #4148 failed with stage
in 1 minute and 29 seconds
......@@ -49,10 +49,13 @@ from flask_dance.consumer import oauth_authorized
app = Flask(__name__)
proxy_count = int(os.getenv('PROXY_COUNT') or 0)
if proxy_count:
from werkzeug.middleware.proxy_fix import ProxyFix
# App is behind proxies that sets the X-Forwarded-For, -Host and -Proto headers.
app = ProxyFix(app, x_for=proxy_count, x_host=proxy_count, x_proto=proxy_count)
# Handle being behind proxies that sets the X-Forwarded-For, -Host and -Proto headers.
# TODO: Switch to the werkzeug >= 0.15 pattern once it is available in Debian,
# which currently only ships 0.14
# from werkzeug.middleware.proxy_fix import ProxyFix
# app.wsgi_app = ProxyFix(app.wsgi_app, x_for=proxy_count, x_host=proxy_count, x_proto=proxy_count)
from werkzeug.contrib.fixers import ProxyFix
app.wsgi_app = ProxyFix(app.wsgi_app, num_proxies=proxy_count)
# Queue of Jobs.
pending = defaultdict(set)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment