diff --git a/internal/nodes/http_request_cache.go b/internal/nodes/http_request_cache.go index 25694c0..6c6e280 100644 --- a/internal/nodes/http_request_cache.go +++ b/internal/nodes/http_request_cache.go @@ -12,7 +12,7 @@ import ( // 读取缓存 func (this *HTTPRequest) doCacheRead() (shouldStop bool) { - cachePolicy := sharedNodeConfig.HTTPCachePolicy + cachePolicy := this.Server.HTTPCachePolicy if cachePolicy == nil || !cachePolicy.IsOn { return } diff --git a/internal/nodes/http_request_waf.go b/internal/nodes/http_request_waf.go index c6100c5..bab4d2c 100644 --- a/internal/nodes/http_request_waf.go +++ b/internal/nodes/http_request_waf.go @@ -28,8 +28,8 @@ func (this *HTTPRequest) doWAFRequest() (blocked bool) { } // 公用的防火墙设置 - if sharedNodeConfig.HTTPFirewallPolicy != nil { - blocked, breakChecking := this.checkWAFRequest(sharedNodeConfig.HTTPFirewallPolicy) + if this.Server.HTTPFirewallPolicy != nil && this.Server.HTTPFirewallPolicy.IsOn { + blocked, breakChecking := this.checkWAFRequest(this.Server.HTTPFirewallPolicy) if blocked { return true } @@ -201,8 +201,8 @@ func (this *HTTPRequest) doWAFResponse(resp *http.Response) (blocked bool) { } // 公用的防火墙设置 - if sharedNodeConfig.HTTPFirewallPolicy != nil { - blocked := this.checkWAFResponse(sharedNodeConfig.HTTPFirewallPolicy, resp) + if this.Server.HTTPFirewallPolicy != nil && this.Server.HTTPFirewallPolicy.IsOn { + blocked := this.checkWAFResponse(this.Server.HTTPFirewallPolicy, resp) if blocked { return true } diff --git a/internal/nodes/http_writer.go b/internal/nodes/http_writer.go index 352c2fc..d384c14 100644 --- a/internal/nodes/http_writer.go +++ b/internal/nodes/http_writer.go @@ -342,7 +342,7 @@ func (this *HTTPWriter) prepareCache(size int64) { return } - cachePolicy := sharedNodeConfig.HTTPCachePolicy + cachePolicy := this.req.Server.HTTPCachePolicy if cachePolicy == nil || !cachePolicy.IsOn { return } diff --git a/internal/nodes/node.go b/internal/nodes/node.go index a8d90d6..b36b095 100644 --- a/internal/nodes/node.go +++ b/internal/nodes/node.go @@ -347,12 +347,12 @@ func (this *Node) syncConfig() error { } else { remotelogs.Println("NODE", "loading config ...") } - + nodeconfigs.ResetNodeConfig(nodeConfig) caches.SharedManager.MaxDiskCapacity = nodeConfig.MaxCacheDiskCapacity caches.SharedManager.MaxMemoryCapacity = nodeConfig.MaxCacheMemoryCapacity - if nodeConfig.HTTPCachePolicy != nil { - caches.SharedManager.UpdatePolicies([]*serverconfigs.HTTPCachePolicy{nodeConfig.HTTPCachePolicy}) + if len(nodeConfig.HTTPCachePolicies) > 0 { + caches.SharedManager.UpdatePolicies(nodeConfig.HTTPCachePolicies) } else { caches.SharedManager.UpdatePolicies([]*serverconfigs.HTTPCachePolicy{}) }