I use hostnames to temporarily redirect certain hostnames to localhost when coding.
Problem is Firefox caches DNS entries for much longer than I would expect (network.dnsCacheExpiration
has no effect).
How can I force Firefox to reset its DNS cache on-demand?
Open the Start Menu and start typing command prompt until you see it in the results. 2. Type ipconfig /flushdns when the prompt loads and hit Enter on the keyboard. The DNS Cache database on your computer is now clear.
Firefox is an Internet browser which integrates a DNS cache feature. This feature automatically saves the DNS settings of websites that you frequently visit. DNS settings are records that contain a website's domain name and its corresponding Internet Protocol address.
3 Answers. Show activity on this post. The DNS cache doesn't ever flush, unless you explicitly tell it to or you make a DNS/networking related configuration change. DNS records have a Time To Live (TTL) value associated with them which tells a DNS cache how long the particular record is good for.
The accepted answer doesn't work for me. It clears cached pages, but not dns entries.
Instead, I go to this URL: about:networking#dns
, then click the Clear DNS Cache button.
I'm afraid I don't recall where I learned about that, but the existence of that button pretty clearly indicates that Mozilla intends it to be how you do this.
WHY THIS MATTERS: I sometimes modify my hosts file (Windows), then flush DNS in the OS (admin cmd prompt, ipconfig /flushdns
. That typically works the first time I do it, but when I remove a host file entry to go back to the real address, Firefox doesn't pick it up without this.
According to this thread on mozilla support by jscher2000:
"Clearing the cache is supposed to clear both pages and DNS entries.
Another way to flush the DNS cache might be to set it to a very small number of records:
(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk.
(2) In the search box above the list, type or paste dns and pause while the list is filtered
(3) Double-click the network.dnsCacheEntries preference and enter a low value such as 5 and click OK
(4) Leave network.dnsCacheExpiration and network.dnsCacheExpirationGracePeriod with their default values (you can right-click > Reset if needed)"
also,
You can remove all data stored in Firefox from a specific domain via "Forget About This Site" in the right-click context menu of an history entry ("History -> Show All History" or "View -> Sidebar -> History").
Found the issue (will submit a bug report to Firefox).
When Enable DNS over HTTPS
is enabled, Firefox ignores entries in /etc/hosts
.
Great security feature to enforce DNS over HTTPS, but I believe localhost
should still resolve locally.
Bug report submitted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With