是否可以在 Gin (golang) 中缓存静态文件?
我试过:
router := gin.Default()
router.Static("/assets", "./assets")
但是每当我刷新页面时,我都会收到状态代码为 200 的响应。我认为它应该是 304(或类似的),但是 https://github.com/gin-gonic/gin没有提到 HTTP 缓存(至少现在是这样)。
如何在 gin 中处理静态文件缓存?
最佳答案
如果您使用的是 Chrome,这可能是原因:
You probably have the Disable cache (while DevTools is open) option selected in the Preferences panel of DevTools. Chrome is sending Cache-control:no-cache header
关于go - Gin静态文件缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49724142/