I'm able to reproduce this error on an HTTPS proxy, running Ubuntu 14.04:
/someproject/node_modules/http-proxy/lib/http-proxy/index.js:119
throw err;
^
Error: socket hang up
at createHangUpError (http.js:1473:15)
at Socket.socketCloseListener (http.js:1523:23)
at Socket.emit (events.js:95:17)
at TCP.close (net.js:466:12)
Reproduction Steps:
siege https://myserver.whatever,I am getting the exact same error, but it is seems like it is a recent development.
Definitely due to not catching the proxy's emitted errors. Adding a basic:
proxy.on('error', function(err) {
return console.log(err);
};
fixes the issue.
Yeah, I fixed the same thing this morning. Thanks!
Rock on!
This is how I solve the issue
var apiProxy=httpProxy.createProxyServer({
target:{
protocol: 'https:', // if you are running a http domain or localhost use http otherwise use https
host: 'localhost ', // or the domain where your api is located
port: 3000 // whatever port your api is running on
},
changeOrigin: true
});
webserver.get('/signup',function(req,res){
apiProxy.web(req,res);
});
I meet this problem, it doesn't fix my error
proxy.on('error', function(err) {
return console.log(err);
};
Most helpful comment
Definitely due to not catching the proxy's emitted errors. Adding a basic:
fixes the issue.