It sounds to me like your hosts file isn’t getting updated. What version of Windows are you on again?
For now, you can manually update it by pointing the local domain to Local’s Docker Machine IP. To get the IP of the Local machine, you can click on any Local site then go to the Database tab and note what the Remote Host is.
Here’s a quick guide on how to do add it to the hosts file if needed:
The purpose of the hosts file is to bypass DNS lookup, so your computer looks here first before it sends the requests off to the DNS servers listed in your work settings. This is what allows you to use a fake domain or point a domain somewhere other than where it is really hosted.
the hosts file entry doesn’t continuously change, the entries only need updating if you have changed the domain (host header) used for the website or the destination IP address has changed. Since neither of these has changed, there is nothing that needs updating. The NAT IP address on the VM is static not dynamic.
Also please do note that If the entry was missing or wrong, then the website would have NEVER worked period, it could not be intermitant, and restarting the site would have no effect, since without the hosts file entry, it would never resolve the virtual machine, it would always try to do a dns lookup on the internet and fail.
I installed this on both my machine and my sons, but we have both continued to have the same issue that we have to keep restarting the site.
This is more of a problem for my son, because he is not an administrator on his pc, which means every time he has to restart a site, it requires an administrator password for node.js, not sure why.
Do you and your son have some type of internet security, anti-virus, anti-malware, etc (apologies if I’ve asked this in another thread)?
I know most typically lock the file, but it almost sounds like something is intermittently reverting the changes in the hosts file. Is there any way you can check the contents of the hosts file after this issue pops up?
I think you are still misunderstanding how the hosts file works. Here is my previous reply from June 9th above. Nothing is being reverted or removed from the hosts file.
The purpose of the host’s file is to bypass DNS lookup, so your computer looks here first before it sends the requests off to the DNS servers listed in your work settings. This is what allows you to use a fake domain or point a domain somewhere other than where it is really hosted.
the hosts file doesn’t continuously change, it only changes if the entries need updating, which would happen if you have changed the domain (host header) used for the website or the destination IP address has changed, or you add a new site and thus need to add a new entry. Since none of this has changed, there is nothing that needs updating in the hosts file. The NAT IP address on the VM is static not dynamic.
Also please do note that If the entry was missing or wrong, then the website would NEVER work period, it could not be intermitantly right then wrong, and restarting the site would have no effect on this, since without the hosts file entry, it would never resolve the virtual machine, it would always try to do a dns lookup on the internet and fail.
The reason why you’re getting ERR_ICANN_NAME_COLLISION is due to the hosts file not taking effect on either the system-level or in the browser level. I’m not sure which, but you can probably find out by running a ping command to see if it matches the entry in the hosts file. If it matches, then it may be something pertaining to the browser.
If it was properly using the hosts file entry, then you should at the very least be seeing an error along the lines of ERR_CONNECTION_REFUSED or ERR_CONNECTION_TIMED_OUT.
Also, you mentioned getting the ERR_NAME_NOT_RESOLVED error when using .local. Again, this is happening because your hosts file is not taking effect. The reason why the error is different is due to .dev being a TLD. If you ping the .dev domain, you’ll most likely get 127.0.53.53 as a response.
I have been using the hosts file for nearly 20 years, 16 of which I owned a hosting company, and previous to that I was a developer, so I been using it personally for development, and resolving sites during migration or while testing sites on different hosts etc. I have also been advising customers on how to use the hosts file for a very long time.
As I have already pointed out several times, If the hosts file was not taking effect, then it would NEVER work, this would be a permanent issue. It wouldn’t just work one minute and then stop working the next minute.
Ping works just fine and the fake domains from my hosts file resolve to the IP address of the virtual machine as expected.
I also have IIS installed, and I have no problems whatsoever with sites setup here, they work all day long, no random intermittent issues. The only issue is with LOCAL BY FLYWHEEL.
I don’t really know how else I can explain this that will make more sense.
make sure your antivirus software is not blocking the changes that LOCAL is making to the hosts file. Most decent AV products do monitor this file for suspicious changes. As I have just discovered, Bitdefender seems to detecting the changes made by local as it seems to edit the file frequently, and blocking them or commenting them out. Then when you restart, LOCAL puts the changes back again.