Socket hangup while posting request to Node-http-proxy Node.js
Use a callback to listen for the error:
proxy.web(req, res, { target: 'http://mytarget.com:8080' }, function(e) { ... });
I found the solution to this problem with the help of this issuehttps://github.com/nodejitsu/node-http-proxy/issues/180#issuecomment-12244852
the solution is to use middleware for proxy before using the bodyparser
code sample
// use middleware first app.post('/solr/*',function(req, res) { console.log('POST REQUEST') //res.end(); proxy.web(req, res, { target: 'http://' + proxyOptions.host + ':' + proxyOptions.port });})app.use(logger('dev'));// use bodyparser after thatapp.use(bodyParser.json());app.use(bodyParser.urlencoded({ extended: false }));