Resolving Digest Auth challenge in middleware using events?
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript, node.js
- 領域
- backend
調査の方向性
Issue に記載されている generalProxy.web 呼び出しと proxyRes および proxyReq イベント API から始めます。401 Digest チャレンジ、元のターゲット URL、リクエストの再試行、MJPEG ストリーミングがプロキシのライフサイクル全体でどのように公開されるかを確認します。完了条件は、文書化されたサポート対象のアプローチ、または明確に範囲を定めた機能リクエストのいずれかとします。
索引モデルが issue の本文から書いたものです。
説明
I'm using http-proxy to make the MJPEG streams from some internal systems (IP cameras) available on a web portal, which only has port 80 available to access the backend. This works pretty well with this code.
const generalProxy = httpProxy.createProxyServer()
app.use('/proxy/:url', (req, res) => {
// Example URL: http://localhost:8000/proxy/http%3A%2F%2F192.168.140.21%2Fmjpg%2Fvideo.mjpg%3Fresolution%3D80x80
const { url } = req.params
if (!url || typeof url !== 'string') {
res.status(406).send('Missing URL')
return
}
generalProxy.web(req, res, { target: url })
}
However, now I need to target a service that requires Digest Auth, using a client which does not support Digest Auth. Disabling Digest Auth or using Basic Auth on the IP cameras is not an option, unfortunately.
I have been looking at the proxyRes and proxyReq middleware events, and think that I might be able to do something like this:
if target responds with 401:
get Digest Auth header from response
use a Digest Auth module to resolve the Digest challenge, with credentials from environment.
repeat the original request, but with the Digest resolution added to the header
proxy the response back to the client.
However, I'm uncertain on how to proceed from here.
I tried to make a generalProxy.on('proxyRes', (proxyRes, req, res) => {....} where I check for (proxyRes.statusCode === 401) which indicates that a digest challenge might be received. However, I can't find the original target URL in an obvious way, since the proxyRequest object is not provided an argument here.
Also, I'm a little in doubt here, about how I should proceed with forwarding the MJPEG response back to the client, I was thinking something like `stream.on('data', (data)=>res.write(data) but I'm not sure if this is the way to go, and how to obtain the connection to the stream on the middle of a proxy event handler.
Any help will be appreciated
- 主要言語
- 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