From 096aa153abfc434ed3a4670deef042a7607a5d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sun, 25 Sep 2022 10:37:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E7=BC=93=E5=AD=98=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=97=B6=E9=BB=98=E8=AE=A4=E7=BC=93=E5=AD=98=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E8=87=AA=E5=8A=A8=E6=94=AF=E6=8C=81206=20Partial=20Co?= =?UTF-8?q?ntent=EF=BC=8C=E5=B9=B6=E4=BD=BF=E7=94=A8=E7=AE=80=E5=8D=95?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/http_cache_policy_dao.go | 26 ++++++--------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/internal/db/models/http_cache_policy_dao.go b/internal/db/models/http_cache_policy_dao.go index f822753b..5a0c0840 100644 --- a/internal/db/models/http_cache_policy_dao.go +++ b/internal/db/models/http_cache_policy_dao.go @@ -125,25 +125,13 @@ func (this *HTTPCachePolicyDAO) CreateCachePolicy(tx *dbs.Tx, isOn bool, name st MinSize: &shared.SizeCapacity{Count: 0, Unit: shared.SizeCapacityUnitKB}, SkipResponseSetCookie: true, AllowChunkedEncoding: true, - Conds: &shared.HTTPRequestCondsConfig{ - IsOn: true, - Connector: "or", - Groups: []*shared.HTTPRequestCondGroup{ - { - IsOn: true, - Connector: "or", - 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: "初始化规则", - }, - }, + AllowPartialContent: true, + SimpleCond: &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"]`, }, } refsJSON, err := json.Marshal([]*serverconfigs.HTTPCacheRef{cacheRef})