Skip to content
Snippets Groups Projects

webhook: Fix running with no proxies

Merged Emanuele Aina requested to merge wip/em-fix-the-fix-to-the-proxy-fix into master
1 file
+ 8
7
Compare changes
  • Side-by-side
  • Inline
+ 8
7
@@ -49,13 +49,14 @@ from flask_dance.consumer import oauth_authorized
app = Flask(__name__)
proxy_count = int(os.getenv('PROXY_COUNT') or 0)
# 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)
if 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)
Loading