diff --git a/dnsforward/config.go b/dnsforward/config.go index 51b510ff..db4a043f 100644 --- a/dnsforward/config.go +++ b/dnsforward/config.go @@ -138,8 +138,6 @@ func (s *Server) createProxyConfig() (proxy.Config, error) { Ratelimit: int(s.conf.Ratelimit), RatelimitWhitelist: s.conf.RatelimitWhitelist, RefuseAny: s.conf.RefuseAny, - CacheEnabled: true, - CacheSizeBytes: int(s.conf.CacheSize), CacheMinTTL: s.conf.CacheMinTTL, CacheMaxTTL: s.conf.CacheMaxTTL, UpstreamConfig: s.conf.UpstreamConfig, @@ -148,6 +146,11 @@ func (s *Server) createProxyConfig() (proxy.Config, error) { EnableEDNSClientSubnet: s.conf.EnableEDNSClientSubnet, } + if s.conf.CacheSize != 0 { + proxyConfig.CacheEnabled = true + proxyConfig.CacheSizeBytes = int(s.conf.CacheSize) + } + proxyConfig.UpstreamMode = proxy.UModeLoadBalance if s.conf.AllServers { proxyConfig.UpstreamMode = proxy.UModeParallel