This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Mulongo oyo etiyamaki na archive. Tuna motuna mosusu soki osengeli na lisalisi

It is possible to use DoH and have FF parse my local hosts file?

more options

I've been curating a hosts file for years now. And it is awesome, I won't part ways with it! But recently I migrated to Firefox from Chromium. The main feature that made me change was DoH but when I enable DoH Firefox ignores my local hosts file. Any way to use both?

I've been curating a hosts file for years now. And it is awesome, I won't part ways with it! But recently I migrated to Firefox from Chromium. The main feature that made me change was DoH but when I enable DoH Firefox ignores my local hosts file. Any way to use both?

All Replies (4)

more options

Hi aegon, currently the closest option is to have Firefox first check with your DoH service and, if a site is not found, then check with your OS resolver, which would use your hosts file and usually your ISP.

To make sure that is configured, you can check here (the value would be 2):

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box above the list, type or paste trr and pause while the list is filtered

(3) Double-click the network.trr.mode preference to display a dialog where you can enter the desired value from the following list, then click OK

  • 0 - local only, DoH off by default (current setting)
  • 1 - query DoH and local, use first available
  • 2 - query DoH first, fallback to local (checkbox in options)
  • 3 - query DoH only, do not use local (most private?)
  • 4 - use local but test DoH performance (temporary??)
  • 5 - local only, DoH off by user choice (won't be overridden??)

From: https://daniel.haxx.se/blog/2018/06/03/inside-firefoxs-doh-engine/

more options

By the way, do you use your hosts file to block requests to certain domains (redirect to localhost)? You may find it more efficient to use an add-on for that so Firefox doesn't even bother sending a DNS request. However, I don't have any particular recommendations.

more options

HI again Jeff!

Thank you for the info. Yes I am blocking hosts to filter out unwanted junk. But junk is a subjective thing right, and I have a curated list of 200k hosts that suit my needs.

The time of the local resolution is minimal and maybe even faster than any extension running on top of the browser. Also there are other apps and system apps that are being blocked, and the extension only solution can't over those. So it is an option for me.

My guess is that the checking hierarchy could be "fixed" to respect peoples setups, but it is being bypassed for some unknown reason.

I have now to consider if I want to keep FF, or go back to Chromium. :-(

more options

Firefox never reads the hosts file directly. DNS resolution via your OS is what uses the hosts file.