fix: index.html禁用缓存,assets启用长期缓存
- index.html: Cache-Control: no-cache,防止浏览器缓存旧版本 - assets: Cache-Control: max-age=31536000,1年强缓存
This commit is contained in:
@@ -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))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user