changeOrigin:true changes Host header but not Origin header
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript, nodejs
- 領域
- backend, networking
調査の方向性
lib/node-http-proxy/http-proxy.js における現在の changeOrigin の処理を、v0.10.4 の実装および PR #723 と比較してください。issue に記載された WebSocket プロキシの動作を確認し、そのうえで Origin を Host とともに変更することが意図されたものかどうかを明らかにし、結果として生じる動作を文書化またはテストしてください。
索引モデルが issue の本文から書いたものです。
説明
This issue has come up in Vite, which delegates proxying to http-proxy.
When Proxying to a WebSocket service in local development the socket connection can rejected by the server as the Host and Origin header values do not match. This Origin-limiting behaviour is recommended in RFC 6455 and is implemented in the Java websockets API and the Gorillas websocket package.
I looked though http-proxy source code to understand the changeOrigin option. It seems that the option originally did set both Host and Origin headers to match the target, e.g. in version v0.10.4:
A subsequent refactoring for v1.0.0 did not include the setting as far as I can tell. A PR then reinstated the changeOrigin option where it conditionally changes the Host header but not the Origin header. https://github.com/http-party/node-http-proxy/pull/723
So I'm interested to know if dropping the change to the Origin header was for a specific reason, or if it just got missed in the v1.0.0 refactor?
The name "changeOrigin" can be confusing but reflects the terms used the HTTP/1.1 RFC-7230 (Jun 2014). It is notable that the RFC does not mention an Origin header. The Origin header is typically only included in cross-origin requests or same-origin requests other than GET / OPTIONS as defined in RFC-6454 (Dec 2011). I believe the confusion arises from the use of “origin” to mean the originator of a request, and the specific request header. However, it seems reasonable to expect that an option changeOrigin:true would change the Origin header, even if it also changes the Host value.
I can raise a PR to reinstate the Origin change but I'm not clear if there are good reasons not to do so. Given there are quite a few open PRs I'm not confident that project maintainers are in a position to review, merge and release any changes.
Happy to hear any thoughts for or against reinstating the behaviour.
- 主要言語
- JavaScript
- スター
- 14.1k
- フォーク
- 2k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
http-party/node-http-proxy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
http-party/node-http-proxy#1719 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
http-party/node-http-proxy#1721 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
http-party/node-http-proxy#1715 · コメント 1 件 · リアクション 5 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 15/100
http-party/node-http-proxy#1711 · コメント 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
http-party/node-http-proxy#1710 · リアクション 5 件 ·
http-party/node-http-proxy の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
microsoft/TypeScript#65370 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue priority: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
TMHSDigital/Free-Game-Dev-Assets#272 ·
メンテナーはふだん 1 日以内に返信
-
metrics priority: medium
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
LearningCircuit/local-deep-research#8336 ·
メンテナーはふだん 1 日以内に返信
-
ace bug yaml
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
svelte: whitespace-only edit leaves an empty todo, edits not trimmed, filter not restored on reloadオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100