Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"node server" bahind a corporate web proxy #4

Open
sebasolla opened this issue Mar 8, 2018 · 6 comments
Open

"node server" bahind a corporate web proxy #4

sebasolla opened this issue Mar 8, 2018 · 6 comments

Comments

@sebasolla
Copy link

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?

@mildsunrise
Copy link
Member

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) });

@sebasolla
Copy link
Author

you are a genius!!
It works like a charm!

Thank you so much

@mildsunrise
Copy link
Member

Glad it worked :)
I'm reopening the issue, since I'd like to incorporate this into the code someday.

@mildsunrise mildsunrise reopened this Mar 15, 2018
@avissian
Copy link

avissian commented Apr 16, 2018

socks5 proxy:

var bot = botgram(config.authToken,
                 {agent: new (require('socks5-https-client/lib/Agent'))(
                   {"socksHost": "proxy_host",
                    "socksUsername": "user",
                    "socksPassword": "password",
                    "socksPort": 1080})
                  });

@avissian
Copy link

I'm reopening the issue, since I'd like to incorporate this into the code someday.

avissian@e4285be

@mildsunrise
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants