Firefox Blocks Websites Based on /etc/hosts File on macOS

Abstract: Resolve Firefox ignoring /etc/hosts on macOS by disabling DNS over HTTPS and clearing the browser cache.

Created: 2026-08-24 by
Firefox on macOS may appear to block websites that are defined in the /etc/hosts file, creating a frustrating disconnect between system-level DNS overrides and browser behavior. This issue typically stems from Firefox’s strict adherence to its own internal network settings or cached data rather than a fundamental refusal to read the system host file. The most common culprit is the "DNS over HTTPS" (DoH) feature, which can bypass local DNS resolution if not configured correctly, or stale cache entries that prevent the browser from recognizing new host mappings. When you modify /etc/hosts to redirect a domain to 127.0.0.1 or another local address, standard browsers like Chrome usually respect this immediately because they rely on the operating system’s resolver. However, Firefox has historically treated DoH as a separate resolution path. If DoH is enabled, Firefox sends queries directly to the provider’s servers, ignoring the local /etc/hosts file entirely. Additionally, even with DoH disabled, Firefox maintains an internal DNS cache that might persist old records, causing it to ignore updates to the hosts file until the cache is cleared or the application is restarted. Understanding these mechanisms allows users to restore expected functionality without compromising their security setup.

Understanding the Root Cause

To fix this issue, it is crucial to understand why Firefox behaves differently from other Chromium-based browsers. On macOS, the system DNS resolver reads /etc/hosts first before querying external servers. Most applications use this system resolver. Firefox, however, introduced DNS over HTTPS (DoH) to encrypt DNS queries. When DoH is active, Firefox attempts to resolve domains via encrypted channels provided by Mozilla or third-party providers. This process effectively bypasses the local system resolver, meaning any entries in /etc/hosts are invisible to the browser.

Another factor is Firefox’s internal caching. Browsers cache DNS responses to improve performance. If you recently added an entry to /etc/hosts but have already visited the site, Firefox might still hold the previous IP address in its memory. This leads to a situation where the browser loads the old content or fails to connect, even though the system itself correctly resolves the domain to the local address. Clearing this cache or restarting the browser often resolves simple instances of this problem.

Disabling DNS over HTTPS

The primary solution for ensuring Firefox respects your /etc/hosts file is to disable DNS over HTTPS. This forces Firefox to fall back to the standard system DNS resolver, which includes the hosts file. You can adjust this setting through the following steps:

  1. Open Firefox and click the menu button (three horizontal lines) in the top right corner.
  2. Select Settings from the dropdown menu.
  3. In the left sidebar, click on Privacy & Security.
  4. Scroll down to the bottom of the page under the Enhanced Tracking Protection section.
  5. Locate the Enable DNS over HTTPS option.
  6. Click the dropdown menu next to it and select Off.

Once set to Off, Firefox will no longer attempt encrypted DNS resolution. It will defer to the macOS system resolver, which will correctly apply any rules defined in /etc/hosts. Note that disabling DoH reduces privacy slightly by exposing your DNS queries to your ISP or network administrator, but it restores compatibility with local development environments and ad-blocking hosts files.

Clearing Cache and Restarting

If you have already disabled DoH and the issue persists, the problem likely lies within Firefox’s cached data. Browsers store DNS lookups to speed up subsequent visits. If you modified /etc/hosts after visiting a site, Firefox might still be using the old cached IP address. To force Firefox to re-read the system hosts file, you must clear these caches.

  • Clear Site Data: Go to Settings > Privacy & Security > Cookies and Site Data > Manage Data. Search for the affected domain and remove it. This clears all stored data for that specific site.
  • Hard Refresh: While viewing the blocked page, press Cmd + Shift + R on macOS. This forces the browser to reload the page from the server, bypassing the local cache.
  • Restart Firefox: Completely quit the application using Cmd + Q and reopen it. This ensures that any lingering DNS cache entries in memory are flushed.

These steps ensure that Firefox does not serve stale data. In some cases, users find that they need to do both: disable DoH and clear the cache. This combination addresses both the resolution path and the storage of previous results.

Verifying System Hosts Configuration

Before assuming the fault lies with Firefox, verify that your /etc/hosts file is syntactically correct and accessible. macOS requires root privileges to edit this file. Use the Terminal to check the file’s contents by running cat /etc/hosts. Ensure there are no typos in the IP addresses or domain names. For example, a valid entry looks like 127.0.0.1 localhost or 127.0.0.1 example.com.

You can also test the system resolver independently of the browser. Open Terminal and run nslookup example.com. If this command returns the local IP address you specified in /etc/hosts, then the system configuration is correct. If it returns a public IP, there is an issue with your hosts file or network permissions, not Firefox. Correcting the hosts file syntax will resolve the issue across all applications, including Firefox.

Related Troubleshooting Steps

Occasionally, extensions or security software can interfere with Firefox’s network stack. If the above steps fail, consider temporarily disabling privacy-focused extensions that might manipulate network requests. Some ad-blockers or tracking protection scripts can conflict with local host redirections. Additionally, ensure that your macOS firewall or antivirus software is not blocking Firefox’s access to loopback addresses. If you frequently switch between local development and production, consider using a dedicated profile in Firefox to isolate these settings, preventing global changes from affecting your daily browsing experience.

Frequently Asked Questions

Does disabling DoH affect my internet speed?

No, disabling DNS over HTTPS generally does not impact internet speed. In fact, it may slightly improve latency for local sites because the query goes directly to the local resolver instead of traveling to a remote DoH server. The encryption overhead of DoH is minimal, so the difference in general web browsing speed is negligible.

Why does Chrome work but Firefox doesn't?

Chrome uses the system DNS resolver by default, which always checks /etc/hosts. Firefox, by contrast, offers DNS over HTTPS as a default or optional feature. When DoH is enabled, Firefox bypasses the system resolver entirely. Disabling DoH aligns Firefox’s behavior with Chrome’s, making it respect the hosts file.

Can I keep DoH enabled and still use /etc/hosts?

No, not reliably. If DoH is enabled, Firefox sends DNS queries to Mozilla or third-party servers, which do not know about your local /etc/hosts modifications. There is no built-in exception in Firefox to route specific domains through the system resolver while keeping DoH active for others. You must turn DoH off completely.

How do I revert to the default DoH settings?

To re-enable DoH, go to Settings > Privacy & Security > Enable DNS over HTTPS and select Default or Max Protection. This will restore encrypted DNS resolution, but remember that it will once again ignore any entries in your /etc/hosts file.

Is editing /etc/hosts safe on macOS?

Yes, editing /etc/hosts is a standard and safe practice for developers and power users. It simply maps domain names to IP addresses locally on your machine. However, you must use sudo to save changes, and you should avoid deleting existing critical entries to prevent breaking system services. Always backup the file before making edits.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More