STEPS OVERVIEW
- Verify the problem
- By trial and error, start with the most common solution
- Continue until the problem is fixed.
Verify the Problem
The problem can be with a browser or with settings not part of the browser. It is possile to have two browsers, such as Chrome and FireFox that aboth have the problem, each for their own reasons, or through settings not in either browsewr.
Chrome Solutions
Chrome Solution 1 - adulterate the hosts file, placing .localhost at the end of each host name.
At: /etc/hosts:
127.0.0.1 myservername.localhost
Google Chrome Ignoring Hosts File
Chrome Solution 2 - (an answer to this question, not repeated here)
Solutions for FireFox Configuration, in Descending Order of Likelihood
FireFox Solution 1: Disable DNS over HTTPS (DoH), by unchecking the feature in settings. To find the checkbox, open FireFox settings or preferences, whichever you have. Scroll to the bottom of the first panel to find and click on Network Settings. Near the bottom there is a checkbox marked, "Enable DNS over HTTPS". Unchecking that might solve the problem.
Why is my hosts file entry being ignored by the browser?
FireFox Solution 1a - If you want to use DoH AND your hosts file then you need to use DoH as your OS's DNS so it is after the hosts file.
https://www.reddit.com/r/firefox/comments/e64073/dns_over_https_doh_needs_hosts_file/
FireFox Solution 2 - set network.dns.offline-local to false. To do this, type about:config in the address bar. Click through the warning that comes up, then use the configuration search to find "network.dns.offline-local". Toggle it to false.
https://superuser.com/questions/1433325/does-firefox-ignore-the-hosts-file-how-to-make-firefox-honor-the-hosts-file
FireFox Solution 3 - If you are using ip6, make hosts file has ip6 entries.
FireFox Solution 4 - Set both www and non-www domain names in the hosts file.
127.0.0.1 foo.com
127.0.0.1 www.foo.com
FireFox Solution 5 - Disable dns cache in FireFox. To do this, type about:config in the address bar. Click through the warning that comes up, then use the configuration search to find "network.dnsCacheEntries". Change its value to 0.
FireFox Solution 6 - Involve yourself in nsswitch.conf. It is involved in how /etc/hosts is used. May the Force be with you. That is all I have for this.
FireFox Solution 7 - Try more configuration solutions:
browser.fixup.dns_first_for_single_words to True
network.dns.disablePrefetch to True
network.dns.offline-localhost to False
network.dnsCacheEntries to 0 (ZERO)
network.dnsCacheExpiration to 0 (ZERO)
network.dnsCacheExpirationGracePeriod to 0 (ZERO)
credit: Jay Rizzo
FireFox Solution 8 - Try this solution:
Navigate to 3 bars > Preferences > General > Scroll to the end > Network Proxy > settings
Configure Proxies to Access the Internet: *CHANGE* Auto-detect proxy settings for this network
I was using Use System Proxy Settings
I also found that is you change tracking in preferences & config this hides the box's too in Firefox
Navigate to 3 bars > Preferences > Privacy & Security > Tracking Protection >Always& "Do Not Track" >Always
AND YOU ALSO have to set this in the browserabout:config`
privacy.trackingprotection.enabled To True
credit: Jay Rizzo
FireFox Solution 9 - Blame your proxy, if you are using one. Then tinker with it to see if you can fix it.
FireFox Solution 10 - Use an addon such as SwitchHost, hoping the new problems introduced are less than those resolved, bearing in mind the problems might not materialize for a year or more.
FireFox Solution 11 - Involve yourself in fireFox's Trusted Recursive Resolver (trr). It is involved in how /etc/hosts is used. May the Force be with you. That is all I have for this.
FireFox Solution 12 - Stop using CloudFlare for dns,
https://www.reddit.com/r/firefox/comments/f32enr/firefox_ignores_etchosts_file_on_macbook/
FireFox Solution 13 - If your version of FireFox is from 2008, upgrade to a more recent version
http://forums.mozillazine.org/viewtopic.php?p=3274240