Skip to content

Commit

Permalink
Optionally disable tunneldns http response caching to fix cloudflare#745
Browse files Browse the repository at this point in the history
  • Loading branch information
alex4108 authored Jul 13, 2024
1 parent c95959e commit a7e2b29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tunneldns/tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"net"
"strconv"
"sync"
"os"

"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit a7e2b29

Please sign in to comment.