mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Added backward compatible code for reverse proxy in case werkzeug is older.
Make werkzeug greater than equal to 0.15.0
This commit is contained in:
parent
6c662ae672
commit
245a6e6f57
@ -16,6 +16,7 @@
|
||||
##############################################################################
|
||||
blinker==1.4
|
||||
Flask==1.0.2
|
||||
Werkzeug>=0.15.0
|
||||
Flask-Gravatar==0.5.0
|
||||
Flask-Login==0.4.1
|
||||
Flask-Mail==0.9.1
|
||||
|
@ -13,7 +13,6 @@ to start a web server."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
import builtins
|
||||
@ -71,13 +70,17 @@ if not os.path.isfile(config.SQLITE_PATH):
|
||||
class ReverseProxied(object):
|
||||
def __init__(self, app):
|
||||
# https://werkzeug.palletsprojects.com/en/0.15.x/middleware/proxy_fix/#module-werkzeug.middleware.proxy_fix
|
||||
self.app = ProxyFix(app,
|
||||
x_for=config.PROXY_X_FOR_COUNT,
|
||||
x_proto=config.PROXY_X_PROTO_COUNT,
|
||||
x_host=config.PROXY_X_HOST_COUNT,
|
||||
x_port=config.PROXY_X_PORT_COUNT,
|
||||
x_prefix=config.PROXY_X_PREFIX_COUNT
|
||||
)
|
||||
try:
|
||||
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||
self.app = ProxyFix(app,
|
||||
x_for=config.PROXY_X_FOR_COUNT,
|
||||
x_proto=config.PROXY_X_PROTO_COUNT,
|
||||
x_host=config.PROXY_X_HOST_COUNT,
|
||||
x_port=config.PROXY_X_PORT_COUNT,
|
||||
x_prefix=config.PROXY_X_PREFIX_COUNT
|
||||
)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
def __call__(self, environ, start_response):
|
||||
script_name = environ.get("HTTP_X_SCRIPT_NAME", "")
|
||||
|
Loading…
Reference in New Issue
Block a user