Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gsf4726
Copy link

@gsf4726 gsf4726 commented Jul 21, 2021

Fixes #1455

@edspencer
Copy link

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.

@franckc
Copy link

franckc commented Oct 19, 2021

Fix works great. I have been using it on my project. Would be awesome to see this merged in! Please.... :)

edspencer added a commit to oplabs/node-http-proxy that referenced this pull request Nov 19, 2021
@edspencer
Copy link

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 🤦

roderik added a commit to settlemint/node-http-proxy that referenced this pull request Nov 25, 2021
@ReyRod
Copy link

ReyRod commented Dec 7, 2021

As this project is dead, we had to apply this change with https://www.npmjs.com/package/patch-package, thanks for the solution @gsf4726

BerndSchrooten added a commit to datacamp-engineering/node-http-proxy that referenced this pull request Jun 8, 2022
@sidx1024
Copy link

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');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error emitted on proxy server after original request is aborted
5 participants