node-http-proxy
node-http-proxy copied to clipboard
Possible connection leakage
After migrating from node.js v10.24.1
to v16.14.2
, encountered some weird behaviour: different applications report connection troubles, something like no buffer space available
. Also my application which uses Server Sent Events (SSE) stopped detect SSE channel disconnects (which is proxied under the hood).
The workaround looks like:
onProxyReq: (proxyReq, req, res) => {
proxyReq.on('close', () => res.end());
}
Some more context:
-
macOS
, -
nvm 0.39.1
, -
create-react-app
, -
http-proxy-middleware 2.0.6
, -
http-proxy 1.17.8
.
There absolutely is a leak, due to https://github.com/nodejs/node/issues/41117 , and a workaround is available in https://github.com/http-party/node-http-proxy/pull/1559 and pushed to NPM as http-proxy-node16
.
The fix helped me as well. Thank you :D
I am using vite
and trying to use Server Sent Events. Is this what's responsible for the following error you think ? :
{"statusCode":403,"message":"sse already opened","error":"Forbidden"}
Edit: From what I have read, I guess not since I have node v19+