Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  107] [ 7]  / answers: 1 / hits: 27429  / 9 Years ago, tue, october 6, 2015, 12:00:00

I use reverse proxy from the following module
https://github.com/nodejitsu/node-http-proxy



and I got in err for the following code



proxy.on('error', function (err, req, res) {
res.end('Error occurr'+ err);
});


connect ECONNREFUSEDwhat does it mean this error and what can be possible solution to it?



I use the



proxy = httpProxy.createProxyServer({});

proxy.web(req, res, {
target: 'http://' + hostname + ':' + port
});

proxy.on('error', function (err, req, res) {
res.end('Error occurr'+ err);
});


and I need just to proxy calls to new port


More From » node.js

 Answers
3

ECONNREFUSED means there is no server process listening at the specified port. What hostname and port are you using? Can you connect directly (without the proxy)?



P.S. Unrelated to ECONNREFUSED, but you should also set changeOrigin in the options passed to proxy.web:



proxy.web(req, res, {
target: 'http://' + hostname + ':' + port,
changeOrigin: true
});

[#64817] Monday, October 5, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
katianatasham

Total Points: 293
Total Questions: 110
Total Answers: 103

Location: Saint Helena
Member since Mon, Jun 28, 2021
3 Years ago
;