"Error: connect ECONNREFUSED" when connecting through a proxy server #342

danielnode opened this Issue Jan 7, 2014 · 5 comments


None yet
2 participants

I'm using a proxy server and getting following error:

{ [Error: connect ECONNREFUSED]
syscall: 'connect',
source: 'socket' }

How can I fix this problem?


mscdex commented Jan 7, 2014

With the information you've given, I have no idea.

I try to connect to a imap-server through a proxy server. The connection ist obviously refused (Error: connect ECONNREFUSED) because of the proxy server I'm using.

My question is:
Is there a way to specify my proxy server (host and port), so the connection ist going through the proxy?
A hard-coded solution would be fine too.


mscdex commented Jan 7, 2014

node-imap does not explicitly support proxies. However it looks like it's not even connecting to your proxy? Are you sure you're able to reach the proxy server at all?

I'm sure the proxy server refuses the connection to the imap-server (e.g. imap.gmail.com).
When using "http" in node.js I can specifiy a proxy server in the requestOpts and connections will go through the proxy successfully. As I see it, the connection in node-imap is set up with a socket (Socket = require('net').Socket) and doesn't use http.


mscdex commented Jan 8, 2014

Correct, IMAP is a completely separate and different protocol from HTTP.

mscdex closed this Apr 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment