8

I am trying to install ruby on windows 7 behind a proxy.

I have looked at various forums and have set (i think) the http_proxy successfully (see below)

SET HTTP_PROXY=http:username:password@http://proxyhere.com:8080

however, i now get the following error trying to install a gem:

SocketError: getaddrinfo: No such host is known.

Any ideas?

1
  • A possible duplication of this thread
    – rb512
    May 17, 2012 at 10:42

2 Answers 2

12

The HTTP_PROXY syntax needs to be URI:

SET HTTP_PROXY=scheme://user:pass@host:port/path

scheme could be http or https and on some cases path could be absent.

No browser (or RubyGems) will accept as valid URL the one you provided.

So in your case:

SET HTTP_PROXY=http://username:[email protected]:8080/

Hope that helps

2
  • And what if I what to remove the proxy settings while working on a network without proxy? What should I do?
    – ben
    Sep 10, 2014 at 15:58
  • @ben if proxy is already set, you need to do: SET HTTP_PROXY= which will unset the environment variable. You can also check your permanent environment variable settings (Google is your friend on how to change that) Sep 10, 2014 at 16:12
5

At work i have a proyx also, SET HTTP_PROXY=http://proxyhere.com:8080 works there, so try it without usename/password. It depends on the type of proxy i presume.

You could also use:

gem install --http-proxy http://proxyhere.com:8080 $gem_name

See this for more info How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.