mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-05 23:35:48 +08:00
缓存在响应中可以添加Age Header
This commit is contained in:
@@ -208,11 +208,15 @@ func (this *HTTPRequest) doCacheRead() (shouldStop bool) {
|
||||
}
|
||||
|
||||
// 设置cache.age变量
|
||||
this.varMapping["cache.age"] = strconv.FormatInt(reader.ExpiresAt()-utils.UnixTime(), 10)
|
||||
var age = strconv.FormatInt(reader.ExpiresAt()-utils.UnixTime(), 10)
|
||||
this.varMapping["cache.age"] = age
|
||||
|
||||
if addStatusHeader {
|
||||
this.writer.Header().Set("X-Cache", "HIT, "+refType+", "+reader.TypeName())
|
||||
}
|
||||
if this.web.Cache.AddAgeHeader {
|
||||
this.writer.Header().Set("Age", age)
|
||||
}
|
||||
|
||||
// ETag
|
||||
// 这里强制设置ETag,如果先前源站设置了ETag,将会被覆盖,避免因为源站的ETag导致源站返回304 Not Modified
|
||||
|
||||
Reference in New Issue
Block a user