How to use a proxy server behind a proxy server?

I get the following output from the sudo package installation command:

Fetching source index for `http://rubygems.org/` Could not reach rubygems repository `http://rubygems.org/` Could not find gem 'rspec-rails (>= 2.0.0.beta.22, runtime)' in any of the gem sources. 

I have $ http_proxy installed correctly, and I added gem: -http-proxy = my proxy for ~ / .gemrc. These settings are what allow the teams of my gem to work, and I hoped that they would translate into bundles, but would fail.

Thinking sudo may not inherit my entire my environment, I also added these settings to my root user, but nada.

At this point, the binder is preventing me from deploying my application, and I can find very few others working on it. If I don't have an answer, I will be forced to break the bundle from my Rails application (which I wouldn't mind doing ...)

+47
ruby ruby-on-rails proxy rubygems bundler
Oct. 06 '10 at 21:30
source share
11 answers

I use Mac OS and just set http_proxy in bash

 export http_proxy=http://user:password@host:port 

and it works great. Did you use sudo ? If you do this, by default sudo does not save the http proxy.

see here to fix:

https://memset.wordpress.com/2010/10/14/bash-http_proxy-from-a-user-environment-to-sudo-one/

+61
Dec 21 '10 at 6:03
source share

I realized that setting HTTP_PROXY (in addition to http_proxy) made a positive difference, i.e. worked for me. Suppose you set the http_proxy environment http_proxy correctly, try (if you use bash)

 export HTTP_PROXY=$http_proxy 

and then also use the -E option for sudo (to save environment variables), so

 sudo -E bundle install 

Jarl

+15
Aug 15 '11 at 9:02
source share

to get a bunch of proxies on win XP / 7 I needed to do the following:

I added http_proxy to environment variables

  • My computer
  • Advanced system settings
  • Extended tab
  • Variables
  • New
  • Variable Name = http_proxy
  • Variable Value = MY_PROXY
  • Click ok

Change MY_PROXY to what you have.

this worked for bundler. Setting up the .gemrc proxy server worked only for gems.

thanks Jamie

+5
Sep 28
source share

You can download the necessary stones locally with gem installation and then install the package. I don’t know for sure, but it works.

+3
Oct 21 2018-10-10
source share

If you do not want to set a global variable in the system, you can edit ~ / .gemrc and write it like this:

 --- :benchmark: false :verbose: true :sources: - http://rubygems.org/ - http://gems.rubyforge.org :backtrace: false :bulk_threshold: 1000 :update_sources: true gem: --http-proxy=http://USERNAME:PASSWORD@ADDRESS:PORT 
+2
03 Sep '12 at 9:12
source share

possibly more flexible and secure batch file:

 SET /P login="Enter proxy login: " SET /P password="Enter proxy password: " SET HTTP_PROXY=http://%login%:%password%@proxy.com:8080 SET HTTPS_PROXY=%HTTP_PROXY% CLS bundle install 
+2
Aug 25 '15 at 11:34
source share

Windows OS run the following command before executing bundle install

 SET http_proxy=http://user:password@host:port 
+1
Jun 14 '15 at 7:14
source share

Make sure your default OS HTTP address is already configured. If you are using Linux, try the following command to find out which proxy server it is pointing to.

 echo $http_proxy 

On my Ubuntu operating system, I set my http_proxy environment variable to my proxy in ~ / .bashrc

0
Oct 15 '10 at 4:57
source share
 $ export http_proxy="http://username:password@host:port" $ export ftp_proxy="http://username:password@host:port" $ sudo visudo 

Add this line to the file:

 Defaults env_keep = "http_proxy ftp_proxy" 

Above this line:

 Defaults env_reset 

then execute your command as sudo, it will work.

ref: https://memset.wordpress.com/2010/10/14/bash-http_proxy-from-a-user-environment-to-sudo-one/

0
Aug 26 '15 at 13:26
source share

I am running Ubuntu. The variable $ http_proxy is set, but it does not work with multiple elements. One of these items is a gem.

If you put the following in your ~ / .gemrc file, it will work.

http_proxy: proxy-url: port

Replace the proxy-url: port with your proxy address and port. After I added this, I ran "bundle install" and everything went as expected.

0
Sep 14 '16 at 20:44
source share

In order for the bundle install command to work with the proxy server in windows, do the following:

  • Edit the .gemrc file. Open a Windows command prompt and type: notepad %userprofile%\.gemrc .
  • The .gemrc file is open in notepad. Enter the new line http_proxy: http://username:passwordEncodedWithUrlencode@proxyaddress:proxyport . Password must be encoded using urlencode.
  • Close the .gemrc file and save it.
0
Nov 07 '17 at 13:45
source share



All Articles