How to set different ttl times for blocked and forwarded domains?

Hello,
I know that the default TTL value in the folder is set to a very low time so that temporarily pausing or white/blacklisting a website works immediately.
I would like to increase the TTL value for redirected/allowed websites to reduce unnecessary requests - the client can use its own cache. Nevertheless, the TTL value for blocked pages should still be very low in order to be able to use the pausing of Pi-Hole or the whitelisting of domains in a meaningful way immediately.
What settings would I have to make for that?
Thank you!

You can use a dnsmasq configuration. Put this in a new file with the .conf suffix in directory etc/dnsmasq.d, then restart Pi-hole.

--min-cache-ttl=
Extend short TTL values to the time given when caching them. Note that artificially extending TTL values is in general a bad idea, do not do it unless you have a good reason, and understand what you are doing. Dnsmasq limits the value of this option to one hour, unless recompiled.

But wouldn't that affect all results, i.e. redirected and blocked websites?

There is no immediate need to change anything:
For any forwarded domain, Pi-hole would respect the TTL as provided by its upstream and pass that on in its reply to the requesting client.

Just like the DNS protocol intends it to be. :wink:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.