From a950acb2d6f05857ceb0767cecfae870e20af624 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 3 May 2026 20:16:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20index.html=E7=A6=81=E7=94=A8=E7=BC=93?= =?UTF-8?q?=E5=AD=98=EF=BC=8Cassets=E5=90=AF=E7=94=A8=E9=95=BF=E6=9C=9F?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - index.html: Cache-Control: no-cache,防止浏览器缓存旧版本 - assets: Cache-Control: max-age=31536000,1年强缓存 --- backend/cmd/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/cmd/main.go b/backend/cmd/main.go index 611f6f8..21d9197 100644 --- a/backend/cmd/main.go +++ b/backend/cmd/main.go @@ -262,6 +262,7 @@ func setupEmbeddedFrontend(r *gin.Engine) { } r.GET("/assets/*filepath", func(c *gin.Context) { + c.Header("Cache-Control", "public, max-age=31536000, immutable") c.FileFromFS(c.Request.URL.Path, http.FS(distFS)) }) @@ -278,6 +279,7 @@ func setupEmbeddedFrontend(r *gin.Engine) { return } + c.Header("Cache-Control", "no-cache, no-store, must-revalidate") serveIndexHTML(c, string(indexHTML)) }) }