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

http_proxy and https_proxy (and probably no_proxy) not supported out of the box #356

Open
HoneyryderChuck opened this issue Jul 20, 2016 · 5 comments

Comments

@HoneyryderChuck
Copy link

I don't know if this was by design, but it took me some figuring out on how to explicitly set proxy.

However, for portability, I'd automatically set proxy from the environment (the http{,s}_proxy env var), just like net/http does.

It's not that hard, as URI#find_proxy is all you need to accomplish this. This also has the benefit of supporting the no_proxy env var.

@britishtea
Copy link
Contributor

While convenient, perhaps it's better to be explicit about this. See for example https://httpoxy.org.

@HoneyryderChuck
Copy link
Author

It seems that this could be mitigated by the web server though, as most ruby deployments don't run as CGI (?). Still, this an available convenience from ruby standard library.

HoneyryderChuck pushed a commit to HoneyryderChuck/http that referenced this issue Jul 20, 2016
…proxy support out-of-the-box); makes working in intranets much easier, although I have to convert every Addressable::URI into a ruby URI (Closes httprb#356)
@HoneyryderChuck
Copy link
Author

@brodock
Copy link

brodock commented Oct 1, 2019

I would like to add some context here. Being able to set proxy based on environmental variables like the examples above, is critical when using code inside intranets or "big corps". There are many ways in which connecting to the outside world can be restricted in those environments and a proxy is a way to let whitelisted applications access the external world.

While I understand that a proxy can be a choice of the programmer when explicitly called by the chainable .via method, its also a choice of the system administrator, when defined by the env variables, and we shouldn't break this characteristic.

These three env variables are a default on Linux, and when set, are usually defined in /etc/environments, so its available system-wide, or on a per-application basis.

@tarcieri
Copy link
Member

tarcieri commented Oct 1, 2019

@brodock we're aware of the concept of egress proxies and the associated utility of this feature 😉

If you'd like to move this forward, I'd suggest opening a PR. It seems @HoneyryderChuck had this partially implemented at one point? HoneyryderChuck@4eeacc1

URI#find_proxy appears to do the heavy lifting already.

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

Successfully merging a pull request may close this issue.

4 participants