Resolving Digest Auth challenge in middleware using events?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, node.js
- Ambito
- backend
Direzione di ricerca
Inizia dalla chiamata generalProxy.web e dalle API degli eventi proxyRes e proxyReq descritte nell’issue. Determina come vengono esposti una challenge Digest 401, l’URL di destinazione originale, il nuovo tentativo della richiesta e lo streaming MJPEG durante il ciclo di vita del proxy. Il risultato dovrebbe essere un approccio supportato e documentato oppure una richiesta di funzionalità chiaramente delimitata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- JavaScript
- Stelle
- 14.1k
- Fork
- 2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di http-party/node-http-proxy
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
http-party/node-http-proxy#1719 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
http-party/node-http-proxy#1721 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 55/100
http-party/node-http-proxy#1715 · 1 commento · 5 reazioni ·
-
Is this library is dead?Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 15/100
http-party/node-http-proxy#1711 · 2 commenti ·
-
HTTP3 + QUIC support?Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
http-party/node-http-proxy#1710 · 5 reazioni ·
Tutte le issue di http-party/node-http-proxy
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/TypeScript#65370 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
TMHSDigital/Free-Game-Dev-Assets#272 ·
I maintainer di solito rispondono entro 1 giorno
-
metrics priority: medium
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
LearningCircuit/local-deep-research#8336 ·
I maintainer di solito rispondono entro 1 giorno
-
ace bug yaml
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
svelte: whitespace-only edit leaves an empty todo, edits not trimmed, filter not restored on reloadAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100