New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of client disconnect so that econnreset event is emitted instead of error #1542
base: master
Are you sure you want to change the base?
Fix handling of client disconnect so that econnreset event is emitted instead of error #1542
Conversation
… instead of error
Thank you so much for this fix; this issue has been the bane of my life for weeks and your solution totally fixes it. Would love to see this merged ASAP so I don't have to keep on modifying my local http-proxy files. |
Fix works great. I have been using it on my project. Would be awesome to see this merged in! Please.... :) |
Looks like this project is dead, so in order to use this fix we just forked the project and made the 1 line change in this PR. It seems to work for us. Took about 30 mins, but better than manually editing that file in node_modules 🤦 |
As this project is dead, we had to apply this change with https://www.npmjs.com/package/patch-package, thanks for the solution @gsf4726 |
Monkey patching function for who don't want to use the patch-package. function monkeyPatchHttpProxyLibrary() {
// https://github.com/http-party/node-http-proxy/pull/1542
const filePath = path.join(
__dirname,
'../node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js',
);
const fileContent = fs.readFileSync(filePath, 'utf-8');
const patchedFileContent = fileContent.replace(
`if (req.socket.destroyed && err.code === 'ECONNRESET') {`,
`if (req.aborted && err.code === 'ECONNRESET') {`,
);
fs.writeFileSync(filePath, patchedFileContent, 'utf-8');
} |
Fixes #1455