fix: index.html禁用缓存,assets启用长期缓存

- index.html: Cache-Control: no-cache,防止浏览器缓存旧版本
- assets: Cache-Control: max-age=31536000,1年强缓存
This commit is contained in:
2026-05-03 20:16:11 +08:00
parent 9a6c1d5e3c
commit a950acb2d6
+2
View File
@@ -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))
})
}