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

Accessing conan trough a proxy #78

Closed
bachp opened this issue Jan 7, 2016 · 8 comments
Closed

Accessing conan trough a proxy #78

bachp opened this issue Jan 7, 2016 · 8 comments

Comments

@bachp
Copy link

bachp commented Jan 7, 2016

In corperate environments it is frequently the case that internet connection must go trough a proxy server, sometimes even with authentication required.

It would be good if conan would at least support the following proxy scenarios:

  1. Access the internet trough a HTTP/HTTPS proxy without authentication
  2. Access the internet trough a HTTP/HTTPS proxy with authentication required
  3. Access the internet trough a SOCKSv5 proxy (this allows using SSH tunnels)
@memsharded
Copy link
Member

Conan is using the python "requests" library. From the docs: http://docs.python-requests.org/en/latest/user/advanced/#proxies

It should be possible to define environment variables like:

$ export HTTP_PROXY="http://10.10.1.10:3128"
$ export HTTPS_PROXY="http://10.10.1.10:1080"

or using user/pass urls in the form "http://user:pass@10.10.1.10:3128/"

I suggest doing a first try with environment variables to check if it works, as a temporary workaround while a proper solution is developed.

@bachp
Copy link
Author

bachp commented Jan 8, 2016

Indeed it is working with the solution proposed above.

I also got it working on windows using the following:

> set HTTP_PROXY=http://10.10.1.10:3128
> set HTTPS_PROXY=http://10.10.1.10:1080

Note that you must not put " around the proxy otherwise it won't work.

I think it is worth to add this to the documentation.

@lasote
Copy link
Contributor

lasote commented Jan 8, 2016

great! I'm creating a new issue in conan docs repository to update it with this information.

Thanks

@memsharded
Copy link
Member

Hi @bachp

Proxy configuration has been included in 0.7 release in the conan.conf file, with the following syntax:

[proxies]
# Empty section will try to use system proxies.
# If don't want proxy at all, remove section [proxies]
# As documented in http://docs.python-requests.org/en/latest/user/advanced/#proxies
# http: http://user:pass@10.10.1.10:3128/
# http: http://10.10.1.10:3128
# https: http://10.10.1.10:1080

Just in case you prefer to use it instead of environment variables. Cheers.

@bachp
Copy link
Author

bachp commented Feb 7, 2016

Thanks for the update

@SC-One
Copy link

SC-One commented Apr 22, 2023

It's not possible to add socks5 to Conan ?! (it's just http, https)

@akukhta
Copy link

akukhta commented Oct 4, 2023

Hello. For those who are stuck with conan 2 and proxy server, and came here as first page google links to, here is how to specify proxy server in conan2:

  • Go to ~/.conan2/

  • Add this lines to global.conf file ("http" and "https" should be in lower case) and replace PROTOCOL, IP and PORT with your settings
    core.net.http:proxies={"http" : "PROTOCOL://IP:PORT/", "https" : "PROTOCOL://IP:PORT/"}

Yes, i realize that this information should be known for those who have worked with Request python library, but since Conan is C and C++ package manager, not all developers may be aware of that

Thanks!

@memsharded
Copy link
Member

Thanks for the feedback @akukhta !

We have a pending task in conan-io/docs#3410, to add this to our docs, but unfortunately too many things on our plate, we haven't managed to catch up on this one. I will add a link there to your comment

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

5 participants