question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to catch 'econnreset'

See original GitHub issue

Hi!

Currently all modern browsers support AbortController which can cancel running http request. And http-proxy can catch that and actually provides econnreset event for that case.

But seems like http-proxy-middleware doesn’t expose that to the consumer, list of events doesn’t contain onEconnreset.

Is there a workaround for that case or it might be considered as a bug?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
klimashkincommented, Oct 15, 2019

@chimurai Yes, you right, it’s possible to override the whole proxyError handler!

0reactions
chimuraicommented, Oct 14, 2019

ah, my bad.

Think you can use the onProxyReq option, which just exposes the http-proxy.on('proxyReq') event.

function onProxyReq(proxyReq, req, res) {
  // add custom header to request
  proxyReq.setHeader('x-added', 'foobar');
  // or log the req
}

📓 https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/proxy-events.md#onproxyreq

You should be able to add listeners to proxyReq and req, like you pointed out earlier. https://github.com/http-party/node-http-proxy/commit/927357bedc42f2e3067c44c10ab9563be7d8b032#diff-6b475017a1a35b15c446d2edf40979f6R143

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to catch ECONNRESET? · Issue #705 · nodejs/help
I use https.request to read from server, and the response is fine. But after several minutes, ECONNRESET error crash the application. My ...
Read more >
How do I debug error ECONNRESET in Node.js?
ECONNRESET could be from network problem. As you know it is impossible to catch all the exceptions when testing. Some will show up...
Read more >
How do I debug error ECONNRESET in Node.js?
“ECONNRESET” means the other side of the TCP conversation abruptly closed its end of the connection. This is most probably due to one...
Read more >
What does “Error: read ECONNRESET” mean?
It means that your application dropped it's TCP connection. For example, if you lost your wifi signal while running your app you would...
Read more >
Fixing an ECONNRESET error
The ECONRESET error means that the server unexpectedly closed the connection and the request to the server was not fulfilled. Connection-related ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found