Files

16 lines
543 B
Python
Raw Permalink Normal View History

from werkzeug.middleware.proxy_fix import ProxyFix
2015-11-30 14:32:58 +00:00
class CustomProxyFix(object):
def __init__(self, app, forwarded_proto):
self.app = ProxyFix(app, x_for=1, x_proto=1, x_host=1, x_port=0, x_prefix=0)
2015-11-30 14:32:58 +00:00
self.forwarded_proto = forwarded_proto
def __call__(self, environ, start_response):
environ.update({"HTTP_X_FORWARDED_PROTO": self.forwarded_proto})
2015-11-30 14:32:58 +00:00
return self.app(environ, start_response)
def init_app(app):
app.wsgi_app = CustomProxyFix(app.wsgi_app, app.config.get("HTTP_PROTOCOL", "http"))