A little late to the party, but here (Flask v1) is what the documentation says about ProxyFix.

Documentation for v2

To paraphrase: Deploying your server using gunicorn behind an HTTP proxy you will need to rewrite some of the headers so that the application can work. And Werkzeug ships with a fixer that will solve some of the common setups.

from werkzeug.middleware.proxy_fix import ProxyFix

app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1)
Answer from Thomas Gak-Deluen on Stack Overflow
🌐
ProgramCreek
programcreek.com › python › example › 93325 › werkzeug.contrib.fixers.ProxyFix
Python Examples of werkzeug.contrib.fixers.ProxyFix
def init_app(cls, app): Config.init_app(app) if app.config.get('ENABLE_PROXYFIX'): # handle proxy server headers from werkzeug.contrib.fixers import ProxyFix app.wsgi_app = ProxyFix(app.wsgi_app) if app.config.get('VERBOSE_SQLALCHEMY'): import logging from logging import StreamHandler stream_handler = StreamHandler() stream_handler.setLevel(logging.INFO) sql_logger = logging.getLogger('sqlalchemy.engine') sql_logger.addHandler(stream_handler) sql_logger.setLevel(logging.INFO) Example #2 ·
🌐
GitHub
github.com › ViennaRNA › forna › issues › 45
`from werkzeug.middleware.proxy_fix import ProxyFix` needed? · Issue #45 · ViennaRNA/forna
August 26, 2020 - from werkzeug.middleware.proxy_fix import ProxyFix · Seem to fix this error: File "forna_server.py", line 23, in <module> from werkzeug.contrib.fixers import ProxyFix ImportError: No module named contrib.fixers · For the record, after changing line 23 I was able to run forma_server and I think all the steps I used are below...
Author   ViennaRNA
🌐
GitHub
github.com › pallets › werkzeug › issues › 1484
Changes in ProxyFix are not documented · Issue #1484 · pallets/werkzeug
March 21, 2019 - Deprecated since version 0.15: werkzeug.contrib.fixers.ProxyFix has moved to werkzeug.middleware.proxy_fix. This import will be removed in 1.0. Would it be possible that importing from contrib.fixers give the old behavior and for the documentation and the error message give more details about this change?
Author   pallets
🌐
Pocoo
mitsuhiko.pocoo.org › werkzeug-docs › contrib › fixers.html
Fixers - Werkzeug Documentation
class werkzeug.contrib.fixers.ProxyFix(app)¶ · This middleware can be applied to add HTTP proxy support to an application that was not designed with HTTP proxies in mind. It sets REMOTE_ADDR, HTTP_HOST from X-Forwarded headers. Werkzeug wrappers have builtin support for this by setting the ...
🌐
Docs4dev
docs4dev.com › docs › werkzeug › 0.16.x › contrib › fixers › index.html
Fixers - Werkzeug | Docs4dev
Deprecated since version 0.15: werkzeug.contrib.fixers.ProxyFix has moved to werkzeug.middleware.proxy_fix. This import will be removed in 1.0.
🌐
PyPI
pypi.org › project › flask-reverse-proxy-fix
pip install flask-reverse-proxy-fix
March 2, 2019 - This middleware incorporates the werkzeug.contrib.fixers.ProxyFix and based on the Fixing SCRIPT_NAME/url_scheme when behind reverse proxy Flask snippet. This package can be installed using Pip from PyPi: ... This middleware requires one parameter, a Flask config option, REVERSE_PROXY_PATH_PREFIX, for the path prefix value. Note: The prefix value SHOULD include a preceding slash, it SHOULD NOT include a trailing slash (i.e. use /foo not /foo/). ... from flask import Flask, url_for from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix app = Flask(__name__) app.config['REVERSE_PROXY_PATH'] = '/foo' ReverseProxyPrefixFix(app) @app.route('/') def hello_world(): return url_for('.hello_world')
      » pip install flask-reverse-proxy-fix
    
Published   Mar 02, 2019
Version   0.2.1
🌐
GitHub
github.com › pallets › werkzeug › issues › 1980
ModuleNotFoundError: No module named 'werkzeug.contrib' · Issue #1980 · pallets/werkzeug
December 12, 2020 - This is the problem: from werkzeug.contrib.fixers import ProxyFix ModuleNotFoundError: No module named 'werkzeug.contrib'
Author   pallets
🌐
Readthedocs
flask-dance.readthedocs.io › en › v0.13.0 › proxies.html
Proxies and HTTPS — Flask Dance 0.13.0 documentation
This will allow Flask to discover ... schema. All you have to do is wrap your application with Werkzueg’s ProxyFix middleware, like so: from flask import Flask from werkzeug.contrib.fixers import ProxyFix app = Flask(__name__) app.wsgi_app = ProxyFix(app.wsgi_...
Find elsewhere
🌐
GitHub
github.com › alerta › alerta › pull › 1095 › files
Import ProxyFix from werkzeug.middleware.proxy_fix by jjh74 · Pull Request #1095 · alerta/alerta
November 28, 2019 - from werkzeug.contrib.fixers import ProxyFix · from werkzeug.middleware.proxy_fix import ProxyFix · from alerta.database.base import Database, QueryBuilder · from alerta.exceptions import ExceptionHandlers · Expand Down · Toggle all file notes Toggle all file annotations ·
Author   alerta
🌐
Readthedocs
flask-dance.readthedocs.io › en › v0.8.3 › proxies.html
Proxies and HTTPS — Flask Dance 0.8.3 documentation
This will allow Flask to discover ... middleware, like so: from flask import Flask from werkzeug.contrib.fixers import ProxyFix app = Flask(__name__) app.wsgi_app = ProxyFix(app.wsgi_app)...
🌐
GitHub
github.com › searx › searx › issues › 1830
New release of Werkzeug 1.0.0 breaks searx startup · Issue #1830 · searx/searx
/ws/searx/webapp.py:988: DeprecationWarning: 'werkzeug.contrib.fixers.ProxyFix' has moved to 'werkzeug.middleware.proxy_fix.ProxyFix'. This import is deprecated as of version 0.15 and will be removed in 1.0. app.wsgi_app = ReverseProxyPathFix(ProxyFix(application.wsgi_app)) And here the crash when we deploy searx with the latest release of werkzeug ·
Author   searx
🌐
GitHub
github.com › apache › superset › commit › d15a212e64461bc3814cd7406c231fc9c28261d6
Add support for Werkzeug ProxyFix middleware (#1150) · apache/superset@d15a212
September 20, 2016 - from werkzeug.contrib.fixers import ProxyFix · 17 · 18 · 18 · 19 · 19 · 20 · APP_DIR = os.path.dirname(__file__) @@ -77,6 +78,9 @@ def checkout(dbapi_con, con_record, con_proxy): 77 · 78 · from flask_cors import CORS · 78 · 79 · CORS(app, **app.config.get('CORS_OPTIONS')) 79 ·
Author   apache
🌐
GitHub
github.com › noirbizarre › flask-restplus › issues › 701
Update Documentation for Flask >= 1.1.0 and Werkzeug >= 0.15.0 · Issue #701 · noirbizarre/flask-restplus
August 22, 2019 - from werkzeug.contrib.fixers import ProxyFix app.wsgi_app = ProxyFix(app.wsgi_app) This is what you need: from werkzeug.middleware.proxy_fix import ProxyFix app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_host=1) @noirbizarre perhaps this ...
Author   noirbizarre
🌐
GitHub
github.com › apache › superset › pull › 8117 › files › 954b7280860ab5b36fbf544c7e6be0d1cc9d1eab
Fix to Werkzeug ProxyFix; expose ProxyFix configuration items by ericandrewmeadows · Pull Request #8117 · apache/superset
from werkzeug.contrib.fixers import ProxyFix · mistercrunch marked this conversation as resolved. Show resolved Hide resolved · There was an error while loading. Please reload this page. import wtforms_json · from superset import config · Expand Down ·
Author   apache
🌐
GitHub
github.com › antarctica › flask-reverse-proxy-fix
GitHub - antarctica/flask-reverse-proxy-fix: Python Flask middleware for applications running under a reverse proxy · GitHub
This middleware incorporates the werkzeug.contrib.fixers.ProxyFix and based on the Fixing SCRIPT_NAME/url_scheme when behind reverse proxy Flask snippet. This package can be installed using Pip from PyPi: ... This middleware requires one parameter, a Flask config option, REVERSE_PROXY_PATH_PREFIX, for the path prefix value. Note: The prefix value SHOULD include a preceding slash, it SHOULD NOT include a trailing slash (i.e. use /foo not /foo/). ... from flask import Flask, url_for from flask_reverse_proxy_fix.middleware import ReverseProxyPrefixFix app = Flask(__name__) app.config['REVERSE_PROXY_PATH'] = '/foo' ReverseProxyPrefixFix(app) @app.route('/') def hello_world(): return url_for('.hello_world')
Starred by 10 users
Forked by 11 users
Languages   Python 94.8% | Dockerfile 5.2%
🌐
GitHub
github.com › pallets › werkzeug › blob › main › src › werkzeug › middleware › proxy_fix.py
werkzeug/src/werkzeug/middleware/proxy_fix.py at main · pallets/werkzeug
from werkzeug.middleware.proxy_fix import ProxyFix · # App is behind one proxy that sets the -For and -Host headers. app = ProxyFix(app, x_for=1, x_host=1) · .. versionchanged:: 1.0 · The ``num_proxies`` argument and attribute; the ``get_remote_addr`` method; and ·
Author   pallets
🌐
GitHub
github.com › searx › searx › issues › 997
ImportError: No module named werkzeug.contrib.fixers · Issue #997 · searx/searx
August 15, 2017 - Traceback (most recent call last): File "/usr/local/searx/searx/webapp.py", line 46, in <module> from werkzeug.contrib.fixers import ProxyFix ImportError: No module named werkzeug.contrib.fixers · What should I add into the virtual-env? This is with nginx and uwsgi.
Author   searx
🌐
Werkzeug
werkzeug.palletsprojects.com › en › stable › deployment › proxy_fix
Tell Werkzeug it is Behind a Proxy — Werkzeug Documentation (3.1.x)
from werkzeug.middleware.proxy_fix import ProxyFix app.wsgi_app = ProxyFix( app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1 )