Vagrant Proxy Settings for Host Downloads and Guest Tasks
Configure host downloads and guest provisioners at their own layers when using a proxy with Vagrant and vagrant-proxyconf.
A Vagrant project has a host download path before the guest exists and another path for guest provisioners/package tools. Configure each where it runs.
For host tools consuming these variables, an example route is:
export http_proxy=http://gateway.example:8080
export https_proxy=http://gateway.example:8080
Vagrant documents http_proxy for HTTP box downloads. Plug-in acquisition also needs host reachability; a guest-configuration plug-in cannot download itself. HTTPS destinations may still use an HTTP proxy value. For permitted public downloads with no proxy credentials configured on the relevant host or guest client, the HTTP proxy list can supply candidate HTTP endpoints.
With compatible vagrant-proxyconf already installed, give the guest its route through Vagrantfile:
Vagrant.configure("2") do |config|
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://gateway.example:8080"
config.proxy.https = "http://gateway.example:8080"
config.proxy.no_proxy = "localhost,127.0.0.1"
end
end
The plug-in writes supported guest configuration before provisioners. Its VAGRANT_HTTP_PROXY and related inputs can override file settings, so inspect them when edits do not take effect.
From the guest, localhost means the guest. A host-loopback proxy needs an explicitly reachable path rather than a copied host URL. A shell provisioner's export also ends with that shell/children; it does not establish later login or service policy.
For removal, clear the configuration already written in the guest using the plug-in's documented empty/false inputs. Closing the host terminal does not remove those persistent files.