diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 30ffeee..1bd6896 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -110,6 +110,7 @@ func (this *HTTPRequest) init() { // 缓存相关初始化 "cache.status": "BYPASS", "cache.age": "0", + "cache.key": "", "cache.policy.name": "", "cache.policy.id": "0", "cache.policy.type": "", diff --git a/internal/nodes/http_request_cache.go b/internal/nodes/http_request_cache.go index 03e8c26..7c2c443 100644 --- a/internal/nodes/http_request_cache.go +++ b/internal/nodes/http_request_cache.go @@ -81,6 +81,12 @@ func (this *HTTPRequest) doCacheRead() (shouldStop bool) { } } + // 校验请求 + if !this.cacheRef.MatchRequest(this.RawReq) { + this.cacheRef = nil + return + } + // 相关变量 this.varMapping["cache.policy.name"] = cachePolicy.Name this.varMapping["cache.policy.id"] = strconv.FormatInt(cachePolicy.Id, 10)