4

Having the latest stable Firefox (69.0.2) on Ubuntu 19.04, I realized that FF has its own DNS cache: After applying DNS changes to the DNS server, I purged the systemd-resolved cache like described here. This worked on multiple cli-tools like dig, curl and ping, so the system-wide DNS cache should be purged. But Firefox still got the old DNS record.

This questions brings me to network.dnsCacheExpiration. According to the Mozilla documentation, this is the duration in seconds for caching DNS entries. Default is 60 and my about:config also shows that 60 is set. However, I updated the DNS record half an hour ago and it's still the old one.

For testing purpose, I also tried it on a Windows 10 test machine with the same Firefox version. Surprisingly, the DNS changes were applied immediately and it also has network.dnsCacheExpiration set to 60.

Why is the DNS cache from Firefox not purged after 60 seconds on the Ubuntu machine? Is it a problem of the OS, altouth multiple cli-tools got the new entry?

Lion
  • 16,606
  • 23
  • 86
  • 148

1 Answers1

3

Even though this question is stale, I found very little on the topic searching the web that was helpful. I noticed the same thing that Lion's question outlined, and tried numerous settings that were not successful, such as:

  • network.trr.excluded-domains,
  • network.dnsCacheExpiration,
  • network.dnsCacheExpirationGracePeriod

I found the bugzilla tickets below, which while not directly answering the question, did deal with a related issue with the hosts file not being honored:

The tickets also were not very helpful in their analysis. I did however find three workarounds that worked for me (and hopefully it may help others as well):

  • To clear Firefox's DNS cache manually:

    • goto: about:networking#dns > Clear DNS Cache
  • To get the DNS cache to work decently with a particular domain:

    • goto: about:config > network.dns.forceResolve > list domain(s)
  • To disable Firefox's DNS cache (force it to always resolve without using DNS cache - has a performance impact):

    • goto: about:config > network.dnsCacheEntries > set it to 0
  • I was unaware of these settings very handy – david-giorgi Dec 23 '22 at 13:02
  • Same conclusion here, I tried everything. The strange thing is that the bug is only for certain domains, e.g. facebook.com and youtube.com. For yahoo.fr for example, the DNS is cleared, and I have an error as expected if I set the set to the DNS entry to 127.0.0.1 in my /private/etc/hosts file. Thanks for the investigation, the two bugs are still open. – COil May 13 '23 at 08:42