From a7e2b29fa27b446e3c073cdf858db92c44daa2df Mon Sep 17 00:00:00 2001 From: Alex Schittko Date: Sat, 13 Jul 2024 01:37:51 -0600 Subject: [PATCH] Optionally disable tunneldns http response caching to fix #745 --- tunneldns/tunnel.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tunneldns/tunnel.go b/tunneldns/tunnel.go index 996c84c4..3d7dd4b0 100644 --- a/tunneldns/tunnel.go +++ b/tunneldns/tunnel.go @@ -4,6 +4,7 @@ import ( "net" "strconv" "sync" + "os" "github.com/coredns/coredns/core/dnsserver" "github.com/coredns/coredns/plugin" @@ -90,12 +91,19 @@ func CreateListener(address string, port uint16, upstreams []string, bootstraps upstreamList = append(upstreamList, upstream) } + + // Create a local cache with HTTPS proxy plugin chain := cache.New() chain.Next = ProxyPlugin{ Upstreams: upstreamList, - } + } + // Optionally disable http response caching + if os.Getenv("DISABLE_TUNNELDNS_CACHE") == "true" { + chain.Next = ProxyPlugin{} + } + // Format an endpoint endpoint := "dns://" + net.JoinHostPort(address, strconv.FormatUint(uint64(port), 10))