Should Callback respect X-Forwarded-Prefix headers from reverse proxy?
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
調査の方向性
dash_auth/oidc_auth.py の 277 行目付近にあるリンク先の return 文から始め、設定された ProxyFix が X-Forwarded-Prefix をどのように処理するかを確認します。提供された nginx の location とヘッダーの設定でリダイレクトを再現します。リバースプロキシがそのプレフィックスを提供した場合に最終的なリダイレクトで /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
- スター
- 135
- フォーク
- 67
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
plotly/dash-auth のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
plotly/dash-auth の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
zostera/django-bootstrap4#894 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
use-agent-os/agent-os#3276 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
NousResearch/hermes-agent#117848 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zilliztech/memsearch#759 ·