Zend certified PHP/Magento developer

Firefox refuses to load sites if there is an entry in ‘/etc/hosts’

If I make an entry in /etc/hosts for a site, Firefox (v125.0.3) refuses to load the site. I’m running macOS 14.4.1 (Sonoma).

The entry in the /etc/hosts file is:

93.184.215.14 example.com www.example.com

I’ve read the answers provided in this Stack Overflow post.

At first, Firefox was completely ignoring my hosts file. Now that I’ve turned off “DNS over HTTPS” I am getting the “Unable to connect” page.

The network tab reveals:

NS_ERROR_CONNECTION_REFUSED

And under timings:

Request Timing
Blocked: 39 ms

If I remove the /etc/hosts entry the page loads normally. Also, both Chrome and Safari are working fine and respecting my hosts entry.

I’ve also looked at about:networking#dns which does seem to show the correct IP address. It’s almost as if Firefox is blocking an attempt to load any endpoint where DNS is overridden.