缓存条件增加“强制Range回源选项”

This commit is contained in:
GoEdgeLab
2023-07-31 17:32:09 +08:00
parent ef7d232a9f
commit f7c4b7c793

View File

@@ -90,6 +90,13 @@ func (this *HTTPRequest) doCacheRead(useStale bool) (shouldStop bool) {
return
}
// 是否强制Range回源
if this.cacheRef.AlwaysForwardRangeRequest && len(this.RawReq.Header.Get("Range")) > 0 {
this.cacheRef = nil
cacheBypassDescription = "BYPASS, forward range"
return
}
// 是否正在Purge
var isPurging = this.web.Cache.PurgeIsOn && strings.ToUpper(this.RawReq.Method) == "PURGE" && this.RawReq.Header.Get("X-Edge-Purge-Key") == this.web.Cache.PurgeKey
if isPurging {