"node server" bahind a corporate web proxy
Hi!, I'm getting the following error and I guess is because its trying to do a direct connection instead of using the https_proxy,
Couldn't load the configuration file, starting the wizard.
First, enter your bot API token: xxxxxxxxxx NetworkError: Error: connect ECONNREFUSED 149.154.167.220:443
Any idea?
Botgram currently doesn't support proxying. But apparently it wouldn't be very difficult to add, using this module. If you want to try it, npm install https-proxy-agent and then do the following modifications in server.js:
-var bot = botgram(config.authToken);
+var bot = botgram(config.authToken, { agent: new (require('https-proxy-agent'))(process.env.https_proxy) });
And the following in lib/wizard.js:
- var bot = botgram(token);
+ var bot = botgram(token, { agent: new (require('https-proxy-agent'))(process.env.https_proxy) });
you are a genius!! It works like a charm!
Thank you so much
Glad it worked :) I'm reopening the issue, since I'd like to incorporate this into the code someday.
socks5 proxy:
var bot = botgram(config.authToken,
{agent: new (require('socks5-https-client/lib/Agent'))(
{"socksHost": "proxy_host",
"socksUsername": "user",
"socksPassword": "password",
"socksPort": 1080})
});
I'm reopening the issue, since I'd like to incorporate this into the code someday.
https://github.com/avissian/shell-bot/commit/e4285bee13f7951ae7ddcf07ee16e86c9bf8e72e
It'd be ideal if the bot could inherit proxy settings from the https_proxy environment variable.
My code snippet works for http: and https: proxies, but not for SOCKS proxies... I'll try to merge everything when I have time.