Should Callback respect X-Forwarded-Prefix headers from reverse proxy?
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 38/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
调研方向
从 dash_auth/oidc_auth.py 中第 277 行附近链接到的 return 语句开始,然后检查已配置的 ProxyFix 如何处理 X-Forwarded-Prefix。使用提供的 nginx location 和 header 配置重现该重定向。当反向代理提供此前缀时,最终重定向保留 /my-app1,且不破坏已配置的 base-path 回退,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Could totally be my own inexperience here, but I'm running into redirect issues from my IDP and I think it's because of this line.
My nginx config has an app running on http://127.0.0.1:8050 being accessed through location /my-app1/. So I pass a proxy_set_header X-Forwarded-Prefix /my-app1.
All the auth stuff works out, however the final redirect pushes me to <my-domain> instead of <my-domain>/my-app1 like I would expect. I believe this is because I am not setting url_base_pathname in Dash to be /my-app1/, rather I am only setting requests_pathname_prefix to that value. The reason there being ... unclear .. but I find things only work when setting requests_pathname_prefix vs url_base_pathname
I'm also using a ProxyFix, which is forwarding on that Prefix header, but I am not familiar enough with Flask internals to know where / when it is applied (if at all).
app.server.wsgi_app = ProxyFix( app.server.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1 )
Either way, if I patch
return redirect(self.app.config.get("url_base_pathname") or "/")
to effectively be
return redirect(request.headers.get("X-Forwarded-Prefix") or self.app.config.get("url_base_pathname") or "/")
Everything appears to redirect as intended. So I'm wondering if that header needs to be captured in this return statement.
It's no doubt a bit confusing when you have nginx waitress flask and dash all in line trying to be helpful!
- 主要语言
- Python
- 星标
- 133
- 派生
- 67
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/dash-auth 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 28/100
-
Issue when clientside callback is defined before public callback可能已有人在做 @Godisemo 于 646 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
-
Docs: installation instructions (including oidc)可能已有人在做 @davidhuser 于 698 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 38/100
-
难度 4/5 3-5 天 新手友好度 30/100
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
databricks/databricks-sql-python#1034 ·
维护者通常 1 天内回复
-
premises-missing
难度 2/5 1-3 小时 新手友好度 72/100
WingedGuardian/GENesis-AGI#4432 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 78/100
huggingface/skills#301 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
intuitem/ciso-assistant-community#5275 ·
维护者通常 1 天内回复