Skip to content

Commit

Permalink
add support for X-Forwarded-Port in ProxyFix middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
osaimi committed Jan 28, 2025
1 parent d44882c commit 2b91b20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/configs/feature/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
2 changes: 1 addition & 1 deletion api/extensions/ext_proxy_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 2b91b20

Please sign in to comment.