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

Proxy support #7

Closed
radum opened this issue Sep 17, 2014 · 14 comments
Closed

Proxy support #7

radum opened this issue Sep 17, 2014 · 14 comments
Labels
enhancement This change will extend Got features ✭ help wanted ✭

Comments

@radum
Copy link

radum commented Sep 17, 2014

If we use this behind a corporate proxy will fail with ECONNREFUSED and I'm not sure how this can be updated to take a proxy option when it's called.

@sindresorhus sindresorhus changed the title Behind a corporate proxy this will ECONNREFUSED Proxy support Sep 28, 2014
@sindresorhus
Copy link
Owner

I don't really care about proxy support, but I would consider a good PR ;)

Maybe by using https://github.com/koichik/node-tunnel

@sindresorhus sindresorhus added enhancement This change will extend Got features ✭ help wanted ✭ labels Sep 28, 2014
@floatdrop
Copy link
Contributor

@radum is node-tunnel solving your issue? It seems like right solution to your problem for me.

@sindresorhus
Copy link
Owner

@floatdrop Maybe we should just mention it in the docs?

@floatdrop
Copy link
Contributor

@sindresorhus there is another module - tunnel-agent, which is used in request. I think it worth to mention them in readme 👍

@sindresorhus
Copy link
Owner

@floatdrop tunnel-agent looks like is just node-tunnel: request/tunnel-agent#2

@floatdrop
Copy link
Contributor

@sindresorhus yeah, but with some patches. Hope they will be ported to node-tunnel soon.

@radum
Copy link
Author

radum commented Jan 5, 2015

@floatdrop both node-tunnel and tunnel-agent work just fine, but my problem is not with got missing proxy support is with all the other modules using got and not implementing proxy support.

I've already had this conversation some time ago with @sindresorhus (kevva/download#13) and as he pointed out making every module downstream care about it doesn't work in real life because they suck and nobody cares about them but they are here to stay so IMHO I think proxy support should be handled by the low level modules that are actually doing the work.

Now HTTP(S)_PROXY env vars are fairly common and most of us are using them as a standard across all major OS. As an example I think bower had the same issues a long time ago and is using those env vars to make the requests as do many other modules anyways.

@floatdrop
Copy link
Contributor

@radum thanks for linking this conversation. I agree with @sindresorhus, that it should be implemented in default agent. For example Go has support of HTTP_PROXY (without HTTPS, lol), so Node should do it as well (but apparently it won't nodejs/node-v0.x-archive#1973).

@radum
Copy link
Author

radum commented Jan 5, 2015

Yeah the entire thing it's broken everywhere I know because I'm behind one and it's a pain everyday.

Python guys have done it also for their request version http://docs.python-requests.org/en/latest/user/advanced/#proxies as for Node, it should be part of core IMHO. Thanks for the alternatives and the doc update anyways.

@sindresorhus
Copy link
Owner

I'm open to it, but it would need to be in a form of a good PR (preferably with as much code as possible in depending modules) with promise to continue maintaining it, as I'm not interested.

so Node should do it as well (but apparently it won't nodejs/node-v0.x-archive#1973).

That issue is old so someone could try again, but that person should make sure the new issue has a lot of good arguments and evidence of why it should be in core.

as for Node, it should be part of core IMHO

Agreed!

I do wonder why Node can't just use the system proxy settings.

@vvo
Copy link

vvo commented Apr 21, 2015

I do wonder why Node can't just use the system proxy settings.

Now it's time to tackle this issue for good! :-)

@shinnn
Copy link

shinnn commented Apr 21, 2015

nodejs/node#1490

@avimar
Copy link

avimar commented Sep 27, 2019

For socks5 proxies, this package seems to work as a replacement for node-tunnel which only handles http proxies:

const got = require('got');
const SocksProxyAgent = require('socks-proxy-agent');
const proxyOptions = 'socks5://localhost:8080';
const tunnel = new SocksProxyAgent(proxyOptions);


got('https://sindresorhus.com', {
	agent: tunnel
	})
});

@niknah
Copy link

niknah commented Feb 18, 2022

With the latest version of got...

got('https://sindresorhus.com', {
	agent: { http:tunnel, https:tunnel, http2:tunnel}
	})
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This change will extend Got features ✭ help wanted ✭
Projects
None yet
Development

No branches or pull requests

7 participants