Sometimes on a corporate network, you'll be stuck behind a proxy and working away on a Windows box. Trying to install or update gems like Ruby on Rails with commands like
gem install rails
can give you strange errors. You'll see various things at various points of bashing your head against the wall. Things like
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
or
ERROR: Could not find a valid gem 'rails' () = 0) in any repository
ERROR: While exectung gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
How do I fix this?
Personally, I tried calling the inhouse IT department to try and get things unblocked. They couldn't really help me out. So instead I grabbed a copy of ntlmaps which basically allows you to create and run a proxy on your local machine that will grab all requests and re-package them as if they were coming from IE.
ntlmaps is a neat little python utility so you'll need to have that installed. Read the Install.txt and readme.txt to get a little background and basic info. I changed my server.cfg file filling in the following bits:
NT_DOMAIN:superCorp
USER:calvin
PASSWORD:hobbes
LM_PART:1
NT_PART:0
Now I've got a nice little local proxy ready to run - run it with runserver.bat at the command line - and wait for it to fire up.
You should get something like
NTLM authorization Proxy Server v...blahblahblah
Now listening at COMPUTERNAME on port 5865
COMPUTERNAME is going to be your computer name.
Now, open a new command shell and type in
SET HTTP_PROXY=http://COMPUTERNAME:5865
You'll get no response from that command but don't worry
At last, you can try updating the gem again:
gem update rails
And you should be good to go.