Resolving Digest Auth challenge in middleware using events?
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu với lệnh gọi generalProxy.web và các API sự kiện proxyRes và proxyReq được mô tả trong issue. Xác định cách challenge Digest 401, URL đích ban đầu, việc thử lại request và MJPEG streaming được cung cấp trong suốt vòng đời của proxy. Kết quả cần là một phương pháp được hỗ trợ và có tài liệu, hoặc một yêu cầu tính năng có phạm vi rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- JavaScript
- Star
- 14.1k
- Fork
- 2k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của http-party/node-http-proxy
-
util._extend() is depracatoryĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
http-party/node-http-proxy#1719 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
http-party/node-http-proxy#1721 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
http-party/node-http-proxy#1715 · 1 bình luận · 5 reaction ·
-
Is this library is dead?Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 15/100
http-party/node-http-proxy#1711 · 2 bình luận ·
-
HTTP3 + QUIC support?Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
http-party/node-http-proxy#1710 · 5 reaction ·
Tất cả issue của http-party/node-http-proxy
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microsoft/TypeScript#65370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement good first issue priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TMHSDigital/Free-Game-Dev-Assets#272 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
metrics priority: medium
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
LearningCircuit/local-deep-research#8336 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ace bug yaml
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
svelte: whitespace-only edit leaves an empty todo, edits not trimmed, filter not restored on reloadĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100