I have been working with a DNS proxy for a while now. It replaces for us the use of unbound as a DNS forwarding resolver. The application itself is a security app, something that logs. and potentially blocks, outgoing requests to websites or anywhere really, and shows a blocked page if the webpage violates a policy.
A policy can be set per user, or groups of users. If we block the News category for a user all categorised websites considered to be news are blocked. Uncategorised websites are flagged and categorised with a day or so. The policy can be changed per user, group, or everybody on a server and updates in a few minutes.
To this we re-reroute the DNS (along with some authentication and identifying EDNS data) to our own resolver and it will either return the block page or not. There are other issues with using the DNSProxy rather than Unbound that might make us abandon it anyway, at least until they are fixed*, but a big annoyance now is Safari's caching of DNS queries.
If there is a policy blocking news, and I load a news site on safari ( say sky news, and then start the proxy, the full site and links continues to work in Safari. Firefox and Chrome are blocked even if previously cached.
If I ping sky news I get the IP of our resolver. If I CURL the sky news page, and I see the block page html, and I can see that DNS proxy is working because I log the data for the outgoing datagram and it contains skynews.com. This is true of a ping or of a reload in safari. Except safari seems to ignore the ip that is returned in the DNS proxy.
I have tried a system wide cache removal i.e
. sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
but that also doesn't work.
Flushing the caches in safari doesn't work. (Develop -> Empty Caches). Erasing history doesn't work. A restart sometimes works but not always.
I know this isn't specifically about the DNS proxy but it seems to me that safari's over aggressive caching should be network extension aware. Is there any potential fix here?
- we don't really want the user to be able to quit the proxy, or even have a choice of installing it. Of course people don't want to be tracked but our customers want to track them.