Search code examples
firefoxhosts

Firefox not honoring hosts file


Firefox does not honor the hosts file when browsing to an URL. For example;

My hosts file says 127.0.0.1 local.webdev.com and entering the local.webdev.com URL into the address bar sends me to the internet always, not localhost. Browsing to this URL in another browser works fine.


Solution

  • There is a new feature in Firefox called "DNS over HTTPS" which you may have (accidentally) enabled. Having this option enabled sends your DNS request directly to your DNS server instead of to your OS, which is the default.

    Go to Settings -> General -> Network Settings -> Enable DNS over HTTPS and disable this option.

    This makes sure that your DNS request goes to your OS which will read the hosts file first before going to your DNS