mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-26 10:40:19 -06:00
Ensure that pgAdmin should work behind reverse proxy if the inbuilt server is used as it is. Fixes #4755
This commit is contained in:
parent
1bef98fdfa
commit
82aa2d1819
@ -18,3 +18,4 @@ Bug fixes
|
|||||||
*********
|
*********
|
||||||
|
|
||||||
| `Issue #4199 <https://redmine.postgresql.org/issues/4199>`_ - Ensure that 'ENTER' key in the data filter should not run the query.
|
| `Issue #4199 <https://redmine.postgresql.org/issues/4199>`_ - Ensure that 'ENTER' key in the data filter should not run the query.
|
||||||
|
| `Issue #4755 <https://redmine.postgresql.org/issues/4755>`_ - Ensure that pgAdmin should work behind reverse proxy if the inbuilt server is used as it is.
|
@ -13,6 +13,7 @@ to start a web server."""
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
||||||
|
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
import builtins
|
import builtins
|
||||||
@ -69,7 +70,8 @@ if not os.path.isfile(config.SQLITE_PATH):
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
class ReverseProxied(object):
|
class ReverseProxied(object):
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
self.app = app
|
# https://werkzeug.palletsprojects.com/en/0.15.x/middleware/proxy_fix/#module-werkzeug.middleware.proxy_fix
|
||||||
|
self.app = ProxyFix(app)
|
||||||
|
|
||||||
def __call__(self, environ, start_response):
|
def __call__(self, environ, start_response):
|
||||||
script_name = environ.get("HTTP_X_SCRIPT_NAME", "")
|
script_name = environ.get("HTTP_X_SCRIPT_NAME", "")
|
||||||
@ -95,6 +97,8 @@ if config.DEBUG:
|
|||||||
|
|
||||||
# Create the app!
|
# Create the app!
|
||||||
app = create_app()
|
app = create_app()
|
||||||
|
|
||||||
|
if config.SERVER_MODE:
|
||||||
app.wsgi_app = ReverseProxied(app.wsgi_app)
|
app.wsgi_app = ReverseProxied(app.wsgi_app)
|
||||||
|
|
||||||
if config.DEBUG:
|
if config.DEBUG:
|
||||||
|
Loading…
Reference in New Issue
Block a user