Tuesday, February 27, 2007

How to Update Gems from Behind a Proxy

I have been trying to work out how to use install and update rails from behind a proxy that required authentication. The issue being that web browsers prompt you for your proxy login details. The command prompt on windows doesn't.

I finally got it working but it wasn't quite how the Gem FAQ stipulates, so I thought I would share it.

The Simple Solution

Execute the following command from the command prompt.

set HTTP_PROXY=http://[username]:[password]@[proxyserver]:[port]

Your gem commands should now work fine.

The Complex Solution

  • Get hold of the 'NTLM authorization Proxy Server' currently on source forge as ntlmaps.
  • Configure it so it known your login to the real proxy server. (you edit the server.cfg, but see gems faq page for details)
  • Set HTTP_PROXY as above but pointing to your new proxy server
  • If it still doesn't work, try passing your login credentials to the new proxy server.

Note: I tried the gem commands using the -p switch but most commands don't work properly. I was getting "ERROR: While executing gem ... (Errno::EBADF)"

Using the environment variable HTTP_PROXY instead fixed this.

Post a Comment

GitHub Projects