Google Chrome Ignoring Hosts File
Google ChromeHostsGoogle Chrome Problem Overview
Google Chrome is ignoring the settings in C:/Windows/System32/drivers/etc/hosts
file. Both IE11 and Firefox are installed on the same machine and work as expected.
I've tried all the solutions I could find online including:
- Open
chrome://net-internals/#dns
and click the Clear Hosts Cache button. - Go in Settings, Show Advanced Settings and uncheck the following three options: (X) Use a web service to help resolve navigation errors (X) Use a prediction service to help complete searches and URLs typed in the address bar (X) Use a prediction service to load pages more quickly
- Go in Settings, Show Advanced Settings, click the Clear Browsing Data button, selected Cached Images And Files from the beginning of time, and click Clear Browsing Data.
- Restart Chrome.exe.
- Restart the computer.
- Make sure to add
http://
to the front of the web address. - Make sure proxy settings are turned off
- Run
cmd.exe
and runipconfig /flushdns
- Uninstall and reinstall Chrome
I'm at a loss... Is there anything I missed that I can try or check?
Google Chrome Solutions
Solution 1 - Google Chrome
Seems that Chrome doesn't likes the following extensions for that kind of stuff:
.dev
.localhost
.test
.example
Use .local and the problem seems to disappear.
> Update from [George Udosen][1] suggestion:
.app is also ignored. [1]: https://stackoverflow.com/questions/42636711/google-chrome-ignoring-hosts-file/51801611#comment91879727_51801611
Solution 2 - Google Chrome
This has been identified as a "bug" in Chrome, but it appears to be absolutely intentional behavior. Google Chrome does not honor /etc/hosts
when connected to the Internet. It always does a DNS lookup to determine IP addresses.
While my references below mostly relate to my expereinces with this on Linux, it is not confined to Linux.
https://groups.google.com/a/chromium.org/forum/#!topic/net-dev/iKXqyc40tW0
https://superuser.com/a/887199/75128
https://bugs.chromium.org/p/chromium/issues/detail?id=117655
Solution 3 - Google Chrome
Okay I faced the same problem but then I found the solution. Try this: Go to history (Ctrl+H) -> In the left pane click on Clear browsing data In the new window that opens go to Advanced tab Set Time Range to All Time -> check Cached Images and Files -> click on Clear data Restart your computer, It should start redirecting addresses mentioned in Hosts file (C:\Windows\System32\drivers\etc\hosts)
Note: This Solution is only for Google Chrome
Solution 4 - Google Chrome
If anyone stumbles on this problem in 2021, for me the fix was to disable Use secure DNS
option from chrome settings. After disabling that, all the options in the hosts file started working.
The option is located under Privacy and Security > Use secure DNS
Link to get there faster:
chrome://settings/security
Solution 5 - Google Chrome
Try clearing the DNS Cache:
-
run cmd.exe as administrator
-
type: ipconfig /flushdns
Solution 6 - Google Chrome
I just encountered this tonight and none of these options worked. I discovered that Chrome now hides "www" (https://www.howtogeek.com/435728/chrome-now-hides-www-and-https-in-addresses.-do-you-care/). Chrome was using my hosts file, but I had to add "www." to my hostname in my hosts
file since that's what the browser is actually requesting, even if it doesn't show it.
Solution 7 - Google Chrome
A little late, but after hours i find a solution. It seems that Google Chrome sometimes has problems on recognize the name of the hosts defined en /etc/hosts.
I'm using linux and i'm behind a proxy.
Try adding at the end of the name server: .localhost
Example:
At: /etc/hosts:
127.0.0.1 myservername.localhost
On the virtual-hosts of your server configuration you'll need to rename the server name. In my case, i'm using apache so at /etc/apache/sites-enabled/myserver.conf rename the line of the old server name with:
...
ServerName: myservername.localhost
If you are behind a proxy, you can except all the hosts just adding to the no_proxy vars:
$no_proxy= "localhost"
Finally don't forget to restart the server and try to access on the browser with the new server name.
Solution 8 - Google Chrome
While it was stated that no proxy is being used, I have had the same issue on OS X while using a proxy and the eventual solution was to add a proxy-exception for this domain.
What the OP could try is turn off async DNS via command-line switch as mentioned here in 2015:
> Async DNS: Remove toggle from about:flags
> Async DNS is fairly stable at the moment, so we don't really need the toggle in about:flags anymore. (Note that the --enable-async-dns and --disable-async-dns command-line flags will still work for now.)
This, however, seems to have no effect in my case, as chrome://net-internals/#dns
still displays the internal DNS-client as enabled with no obvious way to turn it off.
Solution 9 - Google Chrome
Had a similar issue working from a windows based server that had proxy settings. In the proxy advanced settings there are 2 options that can help. Ignore proxy setting for local hosts which is a check box; as well as a list of addresses set off my semi-colons where you can except out certain IP destinations. This fixed my issue.
Solution 10 - Google Chrome
simple answer
there are 3 workarounds about this:
1- deleting Visited Links
binary file (beauty)
2- using .local
or .app
instead of your desired TLD (standard & preferred by chrome docs but i don't like it)
3- restarting your computer (ugly)
deleting Visited Links
binary:
- kill all chrome tasks (close all chrome windows:))
- delete
C:\Users\[USERNAME]\AppData\Local\Google\Chrome\User Data\Default\Visited Links
binary
you can define a function in your shell profile to perform this fast and just by a command whenever you face this issue: e.g:
function respectHosts () {
$path = $HOME + "\AppData\Local\Google\Chrome\User Data\Default\Visited Links";
Remove-Item $path;
}
important Note:
it is suggested that first time after deleting Visited Links
binary file, also delete your history cause if you use a url from history, actually you are using the cached dns of that url too: