Created
October 31, 2019 17:11
-
-
Save snivas/2289741d544f594febcd569775dbbac1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def attach_handler(app): | |
from flask import redirect, url_for | |
app.wsgi_app = CustomProxyFix(app.wsgi_app) | |
class CustomProxyFix(object): | |
def __init__(self, app): | |
self.app = app | |
def __call__(self, environ, start_response): | |
host = environ.get('HTTP_X_FHOST', '') | |
if host: | |
environ['HTTP_HOST'] = host | |
return self.app(environ, start_response) | |
FLASK_APP_MUTATOR = lambda app: attach_handler(app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment