diff --git a/api/configs/feature/__init__.py b/api/configs/feature/__init__.py index 9e2ba417801477..4e67e71b32c38a 100644 --- a/api/configs/feature/__init__.py +++ b/api/configs/feature/__init__.py @@ -315,8 +315,8 @@ def WEB_API_CORS_ALLOW_ORIGINS(self) -> list[str]: ) RESPECT_XFORWARD_HEADERS_ENABLED: bool = Field( - description="Enable or disable the X-Forwarded-For Proxy Fix middleware from Werkzeug" - " to respect X-* headers to redirect clients", + description="Enable handling of X-Forwarded-For, X-Forwarded-Proto, and X-Forwarded-Port headers" + " when the app is behind a single trusted reverse proxy.", default=False, ) diff --git a/api/extensions/ext_proxy_fix.py b/api/extensions/ext_proxy_fix.py index 514e0658257293..c085aed98643d3 100644 --- a/api/extensions/ext_proxy_fix.py +++ b/api/extensions/ext_proxy_fix.py @@ -6,4 +6,4 @@ def init_app(app: DifyApp): if dify_config.RESPECT_XFORWARD_HEADERS_ENABLED: from werkzeug.middleware.proxy_fix import ProxyFix - app.wsgi_app = ProxyFix(app.wsgi_app) # type: ignore + app.wsgi_app = ProxyFix(app.wsgi_app, x_port=1) # type: ignore