mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-06 10:00:24 +08:00
创建缓存策略时默认缓存条件自动支持206 Partial Content,并使用简单条件设置
This commit is contained in:
@@ -125,25 +125,13 @@ func (this *HTTPCachePolicyDAO) CreateCachePolicy(tx *dbs.Tx, isOn bool, name st
|
|||||||
MinSize: &shared.SizeCapacity{Count: 0, Unit: shared.SizeCapacityUnitKB},
|
MinSize: &shared.SizeCapacity{Count: 0, Unit: shared.SizeCapacityUnitKB},
|
||||||
SkipResponseSetCookie: true,
|
SkipResponseSetCookie: true,
|
||||||
AllowChunkedEncoding: true,
|
AllowChunkedEncoding: true,
|
||||||
Conds: &shared.HTTPRequestCondsConfig{
|
AllowPartialContent: true,
|
||||||
IsOn: true,
|
SimpleCond: &shared.HTTPRequestCond{
|
||||||
Connector: "or",
|
Type: "url-extension",
|
||||||
Groups: []*shared.HTTPRequestCondGroup{
|
IsRequest: true,
|
||||||
{
|
Param: "${requestPathExtension}",
|
||||||
IsOn: true,
|
Operator: shared.RequestCondOperatorIn,
|
||||||
Connector: "or",
|
Value: `[".html", ".js", ".css", ".gif", ".png", ".bmp", ".jpeg", ".jpg", ".webp", ".ico", ".pdf", ".ttf", ".eot", ".tiff", ".svg", ".svgz", ".eps", ".woff", ".otf", ".woff2", ".tif", ".csv", ".xls", ".xlsx", ".doc", ".docx", ".ppt", ".pptx", ".wav", ".mp3", ".mp4", ".ogg", ".mid", ".midi"]`,
|
||||||
Conds: []*shared.HTTPRequestCond{
|
|
||||||
{
|
|
||||||
Type: "url-extension",
|
|
||||||
IsRequest: true,
|
|
||||||
Param: "${requestPathExtension}",
|
|
||||||
Operator: shared.RequestCondOperatorIn,
|
|
||||||
Value: `[".html", ".js", ".css", ".gif", ".png", ".bmp", ".jpeg", ".jpg", ".webp", ".ico", ".pdf", ".ttf", ".eot", ".tiff", ".svg", ".svgz", ".eps", ".woff", ".otf", ".woff2", ".tif", ".csv", ".xls", ".xlsx", ".doc", ".docx", ".ppt", ".pptx", ".wav", ".mp3", ".mp4", ".ogg", ".mid", ".midi"]`,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Description: "初始化规则",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
refsJSON, err := json.Marshal([]*serverconfigs.HTTPCacheRef{cacheRef})
|
refsJSON, err := json.Marshal([]*serverconfigs.HTTPCacheRef{cacheRef})
|
||||||
|
|||||||
Reference in New Issue
Block a user