-
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
"proxyError" event emitted twice #364
Comments
This is caused by handling an error on both socket and request. |
Is this my fault or the lib's fault? |
Our fault. I'll get to fixing it soon. |
+1. |
+1 |
The offending code is in http-proxy.py:314-317 (and something similar for proxyWebSocketRequest on lines 732-735). //
// Handle 'error' events from the `reverseProxy`.
//
reverseProxy.once('error', proxyError);
reverseProxy.once('socket', function (socket) {
socket.once('error', proxyError);
}); Is it possible that one is fired and the other no? |
After some research this part is causing the problem: reverseProxy.once('socket', function (socket) {
socket.once('error', proxyError);
}); This is not needed as node.js' socket.on('error', socketErrorListener); The Look in https://github.com/joyent/node/blob/master/lib/http.js for the |
fixed issue #364 'proxyError' event emitted twice
Fixed in #374 |
I created a simple proxy server that tries to proxy the request to a non existent server. I've written this to return an error message when the final host is unreachable.
After I make the request, when the
proxyError
is caught, I keep getting two times the same error:I'm expecting the error to be thrown only once. This is the code I'm using:
Assuming that nothing is running on
127.0.0.1:10000
, trying to execute:prints two times the same error message to the console.
I'm running:
The text was updated successfully, but these errors were encountered: