Open
Description
Hi,
I have a proxy (in http and https. both with web sockets) that is working but if the target application (also in node) is stopped, the proxy receives the following error and stops running:
events.js:72
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at errnoException (net.js:901:11)
at TCP.onread (net.js:556:19)
Can anyone please tell me how to overcome this?
I've added a handler to listen to 'error' events but the proxy is still terminated in the event of the target application is stopped.
Thanks!
Best regards,
Hugo
Activity
jcrugzz commentedon Feb 9, 2014
@HugoMag could you please gist a reproducible example of this behavior? If you are listening on the
error
handler, this should not happen.HugoMag commentedon Feb 10, 2014
Hi,
I've created the https://gist.github.com/HugoMag/8914225 with the behavior.
I've tried using the callback API or the Event Emitter API.
From what I've gathered this error happens only in Windows. In OS X is working fine.
Thanks!
Best regards,
Hugo
wclr commentedon Feb 25, 2014
+1 too have such an issue on Windows, I'm listening to error it still happens.
maybe this related #488
wclr commentedon Feb 25, 2014
it seems that #488 fixes the issue
baer commentedon Feb 26, 2014
+1 I can't get my app to stay up since upgrading to 1.x.x and I'm not able to catch it with the proxy error handler.
Error: read ECONNRESET at errnoException (net.js:901:11) at onread (net.js:556:19) --------------------------------------------- at fireErrorCallbacks (net.js:440:15) at Socket._destroy (net.js:472:3) at onread (net.js:556:10)
wclr commentedon Feb 26, 2014
@baer try to apply this fix #488
baer commentedon Feb 26, 2014
That PR does appear to fix the issue. I have two environments exhibiting this problem just to throw some context into the conversation:
Environment 1
node: 0.10.24
node-http-proxy: 1.0.2
OSX
Environment 2
node: 0.10.24
node-http-proxy: 1.0.2
Windows with IIS-Node (Azure Deployment)
They are both proxying to a hitting an IIS (Windows) deployment
Automatically restart onvif proxy if it dies
NinoSkopac commentedon Jun 17, 2021
7 years later, I have this issue.
I've copy-pasted the example code from README.md:
Setup a basic stand-alone proxy server
Saved as test.js, started with
node test.js
, and tested withcurl http://x.com --proxy localhost:8000
, and I got:I understand I can listen for
error
events so the script doesn't crash, but that still doesn't resolve the core issue, which is why the error happens.EDIT
I ran
sudo lsof -i :9000
on my mac and found out the port was already being used by php-fpm. Once I changed the ports in the code, it worked. I expected the script to crash at runtime if it can't bind to the necessary ports #bug?It works:
What I also could've done, to free up the necessary port instead of changing the code is
brew services stop php
yunfan commentedon Jan 12, 2022
how to know which side of this error occured?
i mean it could occured when read from request side and response side
NinoSkopac commentedon Jan 12, 2022
@yunfan Sorry but i don't understand - language barrier.