سؤال

I am trying to install ruby gems behind NTLM proxy. My OS is Windows 7. These are all the solutions that I tried, non of them working.

Using HTTP_PROXY:

set HTTP_PROXY=http://domain\user:pass@proxy.company.com:8080
set HTTP_PROXY=http://domain\\user:pass@proxy.company.com:8080
set HTTP_PROXY=http://domain\\user:pass@proxy.company.com:8080/

All above response bad URI

set HTTP_PROXY=http://user:pass@proxy.company.com:8080

Response: bad response Proxy Authentication Required 407

Using -p or --http-proxy parameter from Ruby

gem install -p "http://domain\user:pass@proxy.company.com:8080" rake

gem install -p "http://domain\\user:pass@proxy.company.com:8080" rake

gem install -p http://domain\user:pass@proxy.company.com:8080 rake

gem install -p http://domain\\user:pass@proxy.company.com:8080 rake

gem install --http-proxy "http://domain\user:pass@proxy.company.com:8080" rake

gem install --http-proxy "http://domain\\user:pass@proxy.company.com:8080" rake

gem install --http-proxy http://domain\user:pass@proxy.company.com:8080 rake

gem install --http-proxy http://domain\\user:pass@proxy.company.com:8080 rake

All response: invalid argument

Try all the options above without the domain or encode the \ to %5C will receive reponse: bad response Proxy Authentication Required 407

What did I miss in these command or setup?

هل كانت مفيدة؟

المحلول

You can use cntlm http://cntlm.sourceforge.net/, so that you have a local proxy that requires no authentication (which in turns connects to the ntlm proxy).

Also: How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

نصائح أخرى

Seems like there is no fix for the moment to make work rubygems behind an NTLM proxy: https://github.com/rubygems/rubygems/issues/360. Anyway, I still found no way to fix it and the only solution is to download a gem (take care of all its dependencies) and install locally (from inside a folder where the gem was saved to):

gem install your_gem_name --local

I have stumbled on a more easier and possibly safer solution that works not just for git but also any command based installers

  • Rubygems in ruby
  • npm in node

One solution running all your traffic from command line is proxied with authentiction.

Wont expose your password in the user:password@domain:port format

Solution:

Download Fiddler, It has a built in way to add authentication headers to all requests.

Once running menu Rules-> Automatically Authenticate (Tick that)

Then for git

git config --global http.proxy http://localhost:8888
git config --global https.proxy http://localhost:8888

Thats it!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top