mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-07-26 11:49:16 +00:00
ed6954307b
The previous fix attempted to re-stream req.body via proxyReq.write() in the proxyReq event handler. This raced against http-proxy's synchronous req.pipe(proxyReq) call: when express.json() consumed the IncomingMessage stream, Node.js's pipe() detected readableEnded and scheduled process.nextTick(proxyReq.end), which fired before the proxyReq socket event. Any subsequent write() threw "write after end", leaving the remote server stalled waiting for body bytes that never arrived (the "Add Rule spins forever" bug). Root fix: a conditional middleware now skips express.json() entirely for requests targeting a remote node on non-auth, non-nodes API paths. The raw stream is left intact, allowing http-proxy's req.pipe(proxyReq) to forward the body correctly.