-
Notifications
You must be signed in to change notification settings - Fork 2k
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
How to cope with "Error: read ECONNRESET" #579
Comments
@HugoMag could you please gist a reproducible example of this behavior? If you are listening on the |
Hi, From what I've gathered this error happens only in Windows. In OS X is working fine. Thanks! |
+1 too have such an issue on Windows, I'm listening to error it still happens. |
it seems that #488 fixes the issue |
+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) |
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 Environment 2 They are both proxying to a hitting an IIS (Windows) deployment |
If a client connection exits unexpectedly (ECONNRESET), the ONVIF proxy dies. This seems like a bug with `node-http-proxy`. As a quick workaround, let's just restart the proxy server from `docker-compose`. http-party/node-http-proxy#579
7 years later, I have this issue. I've copy-pasted the example code from README.md: Setup a basic stand-alone proxy servervar http = require('http'),
httpProxy = require('http-proxy');
//
// Create your proxy server and set the target in the options.
//
httpProxy.createProxyServer({target:'http://localhost:9000'}).listen(8000); // See (†)
//
// Create your target server
//
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
res.end();
}).listen(9000); Saved as test.js, started with
I understand I can listen for EDITI ran var http = require('http'),
httpProxy = require('http-proxy');
//
// Create your proxy server and set the target in the options.
//
httpProxy.createProxyServer({target:'http://localhost:14123'}).listen(13123); // See (†)
console.log('Started proxy');
//
// Create your target server
//
http.createServer(function (req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.write('request successfully proxied!' + '\n' + JSON.stringify(req.headers, true, 2));
res.end();
}).listen(14123);
console.log('Started webserver'); It works: xxx@Ninos-MacBook-Pro ~ % curl http://x.com --proxy localhost:13123
request successfully proxied!
{
"proxy-connection": "Keep-Alive",
"accept": "*/*",
"user-agent": "curl/7.64.1",
"host": "x.com",
"connection": "close"
} What I also could've done, to free up the necessary port instead of changing the code is |
how to know which side of this error occured? |
@yunfan Sorry but i don't understand - language barrier. |
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
The text was updated successfully, but these errors were encountered: