DNS Blocked sites loading on Firefox

So I have my own DNS resolver set up that would block some sites. When running dig or host from the commandline, it does show that there’s no DNS record for the domain name, but I can still open the site on Firefox (also on Chromium, after cleaning all DNS cache from chrome://net-internals/#dns), after a restart even though DNS cache should be cleared after firefox is closed and the DNS resolver specified in /etc/resolv.conf must be used by all applications.

Why is the site still being loaded? For it to be loaded, the domain name must be resolved.

Also I have made a separate file /etc/new_resolv.conf and soft-linked to /etc/resolv.conf so it doesn’t get overriden by systemd-resolvconf every time

Make sure to disable DoH in the your browser.
If the issue persists, check the output:

grep -e "^hosts:" /etc/nsswitch.conf
grep -v -e "^#" -e "^$" /etc/resolv.conf
resolvectl --no-pager status
resolvectl --no-pager query some.blocked.domain
1 Like

You might want to try the KISS approach. Add a line to /etc/hosts assigning the IP address of 127.0.0.1 to the site you want to block and save the file. As that file gets checked first any time you need to resolve an address, that blocks the site before any other part of your network stack gets a look at it. HTH, HAND.

Maybe the “about:networking” command from inside firefox could provide some more info about the DNS in use.