# Stubborn 403 trying to use gems with proxy on windows cygwin

**URL:** <https://www.ruby-forum.com/t/stubborn-403-trying-to-use-gems-with-proxy-on-windows-cygwin/173980>\
**Category:** Rails\
**Created:** [August 18, 2009, 11:56pm UTC](https://www.ruby-forum.com/t/stubborn-403-trying-to-use-gems-with-proxy-on-windows-cygwin/173980 "2009-08-18T23:56:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![najati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/898d66/32.png) [@najati](https://www.ruby-forum.com/u/najati)\
**Post date:** [August 18, 2009, 11:56pm UTC](https://www.ruby-forum.com/t/stubborn-403-trying-to-use-gems-with-proxy-on-windows-cygwin/173980/1 "2009-08-18T23:56:07Z")

</div>

Hey all,

We’re on windows, using cygwin, behind a firewall with a proxy and  
having difficulty (understatement) installing rails. It seems that no  
combination of http proxy parameters and environment variables will get  
this to work, all of them result in the output copied below. At the same  
time, wget will download any of the listed files just file (with the  
http\_proxy env variable set).

Any ideas? Thanks a bunch!  
Najati

cygwin:/cygdrive/c/path\> gem install rails --debug  
Exception `NameError' at /usr/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:161 - uninitialized constant Gem::Comma nds::InstallCommand Exception `Gem::LoadError’ at  
/usr/lib/ruby/site\_ruby/1.8/rubygems.rb:826 - Could not find RubyGem  
test-unit (\>= 0)

Exception `Gem::LoadError’ at  
/usr/lib/ruby/site\_ruby/1.8/rubygems.rb:826 - Could not find RubyGem  
sources (\> 0.0.1)

Exception `Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:290 - bad response Forbidden 403 (http://gems.rubyforge.org/latest_specs.4.8.gz) Exception `Gem::RemoteFetcher::FetchError’ at  
/usr/lib/ruby/site\_ruby/1.8/rubygems/remote\_fetcher.rb:168 - bad  
response  
Forbidden 403 ([RubyGems.org | your community gem host](http://gems.rubyforge.org/latest_specs.4.8.gz))  
Exception `Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:290 - bad response Forbidden 403 (http://gems.rubyforge.org/specs.4.8.gz) Exception `Gem::RemoteFetcher::FetchError’ at  
/usr/lib/ruby/site\_ruby/1.8/rubygems/remote\_fetcher.rb:168 - bad  
response  
Forbidden 403 ([RubyGems.org | your community gem host](http://gems.rubyforge.org/specs.4.8.gz))  
Exception `Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:290 - bad response Forbidden 403 (http://gems.rubyforge.org/yaml) Exception `Gem::RemoteFetcher::FetchError’ at  
/usr/lib/ruby/site\_ruby/1.8/rubygems/remote\_fetcher.rb:168 - bad  
response  
Forbidden 403 ([RubyGems.org | your community gem host](http://gems.rubyforge.org/yaml))  
ERROR: [http://gems.rubyforge.org/](http://gems.rubyforge.org/) does not appear to be a repository  
Exception `Gem::RemoteFetcher::FetchError' at /usr/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:155 - bad response Fo rbidden 403 (http://gems.rubyforge.org/yaml) Exception `Gem::GemNotFoundException’ at  
/usr/lib/ruby/site\_ruby/1.8/rubygems/dependency\_installer.rb:200 - could  
not fi  
nd gem rails locally or in a repository  
ERROR: could not find gem rails locally or in a repository  
cygwin:/cygdrive/c/path\>

---

<div class="post-metadata">

**Author:** ![najati](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/898d66/32.png) [@najati](https://www.ruby-forum.com/u/najati)\
**Post date:** [August 25, 2009, 8:03pm UTC](https://www.ruby-forum.com/t/stubborn-403-trying-to-use-gems-with-proxy-on-windows-cygwin/173980/2 "2009-08-25T20:03:16Z")

</div>

Najati I. wrote:

> [some nonsense …]  
> Forbidden 403 ([RubyGems.org | your community gem host](http://gems.rubyforge.org/latest_specs.4.8.gz))  
> [nonsense continues …]

So it seems as though my proxy is filtering based on User-Agent. I got  
gem to install rails by changing gem’s remote\_fetcher.rb. In def request  
you’ll find

```
ua = "RubyGems/#{Gem::RubyGemsVersion} #{Gem::Platform.local}"
ua << " Ruby/#{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
ua << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
ua << ")"

```

I replaced all of this with a blatant lie:

```
ua = "Wget/1.9.1"

```

and gem worked just fine, so it seems.

I know there are others around the World Wide Web that are having  
similar issues. Without knowing how many of them are caused by this  
issue: maybe it would be worth the little bit of effort to make  
User-Agent a gem parameter?

Live long and prosper,  
Najati
