Vagrant does not work with localhost extension on Chrome

I have mac mac 2015 with macOs Sierra. After too many problems with apache and php, I decided to start Vagrant. I run box.scotch.io for my work.

Before Vagrant I configured the hosts file as follows:

127.0.0.1 devsite.localhost 127.0.0.1 sub.devsite.localhost 

Remember that I cannot change domains and extensions because this is not my project and I have to use them in order for some redirects and APIs to work.

After Vagrant, I changed it to:

 192.168.33.10 devsite.localhost 192.168.33.10 sub.devsite.localhost 

After editing the conf files inside the strollers, it worked fine. BUT not on chrome. I tested safari and firefox and it works great. For some reason, in Chrome, these two were still showing me apache2 files. So I went and deleted the conf files from my local apache (for some reason). The only thing that has changed is that now it shows me 403 forbidden (also Apaches). I tried to disable apache. Now he shows me: "This site cannot be reached."

I pinged them and it showed the correct IP (roaming IP). I cleared the DNS (from the terminal and from chrome) - it still doesn't work. I tried restarting chrome - no. I tried to restart the laptop - no.

So, I thought chrome dooes did not reload the hosts file, so I changed it from .localhost to .localhost2 or .local. Now he shows me 404 from tramps.

The weird part -> Everything I installed with .localhost, since the extension does not work in Chrome ... abclocalhost will not work. If I started apache, abclocalhost will show me 403 is forbidden with apache, even if it is not in the hosts file.

Please note that in firefox and safari it works fine. But I really need chrome and the .localhost extension

I have already lost almost 2 days on this issue, and I can not afford to lose another

+5
source share
2 answers

Find relevant information here: https://bugs.chromium.org/p/chromium/issues/detail?id=489973

In short: this is apparently a well-known Chrome feature: /etc/hosts ignored to resolve hostnames ending in .localhost as a security restriction for OS X. Comment 22 indicates a workaround: add 127.0.0.1 localhost. in /etc/hosts (and note the endpoint after "localhost.").

+2
source

To manage the host, you can use a special plugin https://github.com/devopsgroup-io/vagrant-hostmanager AFAIR solved the Chrome + MacOS problem

0
source

Source: https://habr.com/ru/post/1261196/


All Articles