-
-
Notifications
You must be signed in to change notification settings - Fork 961
Respect HTTP_PROXY, HTTPS_PROXY, NO_PROXY environment variables #560
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
Comments
I think we should just recommend https://github.com/np-maintain/global-tunnel for that. Proxy support is really hard to get right and not something I'm interested in spending time on and I don't want to bloat Got with dependencies to support it. |
Just saw that this is a duplicate of: |
@gajus What do you think about recommending https://github.com/np-maintain/global-tunnel ? With that module it would work for any request library in the dependency-tree, not just Got. |
It is a good solution, but unless every package author that uses Got also adds Alternatively... Got could check for |
This sounds fragile. What if a Got wrapper expects some special functionality from an agent and stops working when it gets a different agent? |
Sorry, assumed the contents of the package based on the name of the package (tunnel being the other one). https://github.com/np-maintain/global-tunnel looks decent.
Anything when used in a global space is fragile. Absolutely valid concern. You could of course workaround it by making |
FYI, the global-tunnel package does not support |
Currently Got allows use of proxies by configuring
agent
(https://github.com/sindresorhus/got#proxies).This approach suffers from the same issues I have described in the issue about logging (#559 (comment)).
tl;dr;
When you have an application which depends on modules that use got, there is no way to enable got proxy without digging through node_modules/ and patching the code.
I have no knowledge of where the HTTP_PROXY convention originates, but it is prevalent practice for the exactly the reason described above – ability to inspect all application traffic without configuring individual HTTP client instances.
"request" package already implements HTTP_PROXY configuration (https://github.com/request/request#controlling-proxy-behaviour-using-environment-variables):
I suggest that got implement equivalent logic.
agent
configuration should remain and it should overrideHTTP_PROXY
setting (it then becomes the responsibility of the HTTP agent to respect the environment variables).The text was updated successfully, but these errors were encountered: