Disable proxy settings in provisioned box
vladonemo opened this issue ยท 14 comments
We use this plugin to setup the proxy in our vagrant boxes. Instead of putting the configuration to the vagrant file, we use the env. variables (on the host OS) for this purpose:
HTTP_PROXY=proxyurl
HTTPS_PROXY=proxyurl
VAGRANT_HTTP_PROXY=proxyurl
VAGRANT_HTTPS_PROXY=proxyurl
After the box is provisioned with this env. variables, how do we clear out the proxy settings in the box? (apt, yum, git, env. variables in the guest OS ...)
It doesn't simply work by clearing out the env. variables in the host OS and reloading the box. My understanding is that vagrant-proxyconf doesn't do anything in this case at the moment.
If a variable is not specified, nothing is done. But if you set the value to an empty string, the configuration should be cleared. The readme tries to explain this.
Thanks for the answer. Now, how do you do this on Windows? My understanding is that it is not possible to create env. variable with empty value. In that case the variable is undefined. The only thing I could do is to set the value to a single space like this:
set "HTTP_PROXY= "
but then I receive this error:
dev: Configuring proxy for Yum...
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.4.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): (URI::InvalidURIError)
Oh my... I didn't have any idea about that kind of restriction.
Should we support magic string "false"
to do the same? That would be in line with Ruby based Vagrant config where the boolean value false
does the same as empty string.
yes, for VAGRANT_HTTP_PROXY and VAGRANT_HTTPS_PROXY. That would be great!
OK. This should be a minor change in the code base. More effort will go into creating tests and documentation.
Travis tests are also broken and another PR is pending, so I'll try to put some love into the project this weekend.
Thaks a lot. I can help you out with the documentation. I don't speak Ruby much :)
I have the same issue! How to workaround now?
- If I set empty values: plugin does nothing and I have old proxy settings.
- If I set space value " ": plugin change settings to space " ".
- If I set false value "false": plugin change settings to false "false".
Unfortunately the only workaround now would be to write the logic to the Vagrantfile
, i.e. setting the variable in Ruby to false
with whatever logic (for example when the env var is "false"
).
And sorry, did not get into fixing this yet. It is anyway on my long todo list. =)
Hi,
I'm having the same problem. Could you perhaps be more specific on the hack? I haven't been able to implement it.
config.proxy.enabled = false # => all applications disabled
did not do the trick
Thanks for your support. And this is an awesome plugin.
I've also confirmed that I'm unable to disable the proxy configuration using the methods mentioned in this issue. It's been a few years since I wrote ruby but I'm going to take a stab a pull request to fix this behavior because I've lost some valuable time troubleshooting it.
Ok, so I think I've figured out how this all works finally and how to implement the feature to disable a configured proxy. This is currently under testing and I hope to have a PR ready to address in the new few days as I have spare time.
@vladonemo @blasrodri @AlexRadch - I believe I've addressed your concerns in the 2.0.0 release. Please confirm.
I'll close out this issue on Jan 11, 2019 if I don't hear from you guys by then. Thanks.
Just tested it and it works in our environment. By setting the proxy env. variables to empty before running vagrant up
all the proxy settings are removed. The opposite use-case works, too.
Thanks a lot for addressing this ๐
Yay! I'm glad it worked and I'm happy to help. ๐