My company's network is using proxy. So when I use vagrant up
, it showed me a 401 permission error.
How can I do some setting to use vagrant?
My company's network is using proxy. So when I use vagrant up
, it showed me a 401 permission error.
How can I do some setting to use vagrant?
Auto detect your proxy settings and inject them in all your vagrant VM
install the proxy plugin
add this conf to you private/user VagrantFile (it will be executed for all your projects) :
now up your VM !
The question does not mention the VM Provider but in my case, I use Virtual Box under the same environment. There is an option in the Virtual Box GUI that I needed to enable in order to make it work. Is located in the Virtual Box app preferences: File >> Preferences... >> Proxy. Once I configured this, I was able to work without problems. Hope this tip can also help you guys.
You will want to install the plugin proxyconf since this makes configuring the proxy for the guest machines pretty straight forward in the VagrantFile
However, there's quite a few things that could still go wrong. Firstly, you probably can't install vagrant plugins when behind the proxy. If that's the case you should download the source e.g. from rubygems.org and install from source
If you solve that problem you might have the fortune of being behind an NTLM proxy, which means that if you are using *nix on your guest machines then you still have some way to go, because NTLM authentication is not supported natively There are many ways of solving that. I've used CNTLM to solve tht part of the puzzle. It acts as glue between standard authorization protocols and NTLM
For a complete walk through, have a look at this blog entry about setting vagrant up behind a corporate proxy
In MS Windows this works for us:
And the equivalent for *nix:
If you actually do want your proxy configurations and plugin installations to be in your Vagrantfile, for example if you're making a Vagrantfile just for your corporate environment and can't have users editing environment variables, this was the answer for me:
(If you don't, just set them as environment variables like the other answers say and refer to them from env in config.proxy.http(s) directives.)