0xERR0R / blocky

Fast and lightweight DNS proxy as ad-blocker for local network with many features
https://0xERR0R.github.io/blocky/
Apache License 2.0
4.62k stars 203 forks source link

[Feature Request] Add "cache-control" http header on DoH server #526

Open PeterDaveHello opened 2 years ago

PeterDaveHello commented 2 years ago

This http header is currently not implemented in Blocky DoH server.

Some famous DoH servers like those:

They do return cache-control http header like the example mentioned in RFC 8484 (DNS Queries over HTTPS (DoH)) 4.2.2 HTTP Response Example

More info: 5.1 Cache Interaction.

Just FYI, Cloudflare, NextDNS and OpenDNS doesn't do that. At least, not yet.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

FileGo commented 2 years ago

I've been looking at this, and I'm a bit puzzled with this part of RFC:

If the DNS response has no records in the Answer section, and the DNS response has an SOA record in the Authority section, the response freshness lifetime MUST NOT be greater than the MINIMUM field from that SOA record (see [RFC2308]).

What should we set the cache-control header to, if there is no records in the Answer section, as well as no SOA records in the Authority section?

kwitsch commented 2 years ago

My guess would be that if there is no DNS record but an SOA record following the RFC2308 the SOA minimum should be used.
If nighter DNS nor SOA entry is present I would guess the TTL should be 0 to guarantee that it's not above the minimum TTL. 🤔