Friday, February 12, 2016

All things about proxy

Protected by the great Chinese Firewall, I feel my mind is as pure as the WhiteSnow. But living in this mighty country as a software engineer, one thing is particularly painful: we have to be the Kung Fu Panda to jump over the wall to google and download things.
I experienced this pain vividly a few weeks ago when I had to re-install a computer, so I decided to write all the “jumping over wall” techniques down.



BTW, when installing git, choose Run Git from the Windows Command Prompt.

git proxies are configured in C:\Users\ME\.gitconfig.
      proxy = PROXY
      sslverify = false
      sslverify = false
      proxy = PROXY
[url "https://"]
      insteadOf = git://
[url ""]
        insteadOf = git://             



npm proxy needs to be setup in C:\Users\ME\.npmrc. Note, you can’t right click and create a file whose name starts with “.”. You can however create a blank file in your editor and save it as “.npmrc”.



To be able to download boxes, I need to setup proxy environment variables in my windows machine:

To enable VMs created by Vagant to be able to download things, I need to setup proxies for VMs as well, to do so, first I need to install a plugin for Vagant:
vagrant plugin install vagrant-proxyconf

Then I can setup proxies for VMs in Vagrantfile:
 if Vagrant.has_plugin?("vagrant-proxyconf")
            config.proxy.http = PROXY
            config.proxy.https = PROXY         
            config.proxy.ftp = PROXY           
            config.proxy.no_proxy  = "localhost,,"

One thing to note is that no_proxy should contain either domains or exact ip address. Wildcard ip addresses do not work, e.g. 192.168.33.* doesn’t work. See



curl will respect https_proxy, http_proxy, no_proxy environment variables (as configured by Vagrant above, for example). If you want curl to bypass proxy for certain url, include the domain or ip address in no_proxy.

You can also use --noproxy to bypass proxies.  
curl  -v --noproxy '*' -XGET ""



This concerns install Cygwin. Follow the wizard step by step, and upon the following step, choose option 2:

This is actually very weird, I do not have proxy setup in IE, so the second option should be equal to first, but using the first or the third option, I simply can’t access any mirror site. Weird!


Edit .m2/settings.xml. If settings.xml is missing, download a default one from, and put it there.
On the proxies paragraph, add proxy:

1 comment: