Browsers cached the pre-fix 404 responses for /static/js/markdown.js and
/static/css/markdown.css (responses carry Cache-Control max-age=14400),
so users kept seeing broken pages after redeploy. A versioned query
string forces clients to refetch the assets; bump ?v= whenever the
static files change.
kevin
merged commit c3f8be58c9 into main2026-08-18 18:25:32 +08:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
背景
PR #2 部署后服务器端已修复(/static 由二进制内嵌提供,实测全站 0 个 404),但部分用户浏览器仍显示异常:静态资源响应带
Cache-Control: max-age=14400,浏览器把修复前的旧 404 响应缓存了下来,继续使用旧页面/旧资源。修复
markdown_assets模板中本地静态资源 URL 增加版本参数:/static/js/markdown.js?v=2、/static/css/markdown.css?v=2。URL 变化后浏览器必然重新请求,旧缓存自动失效。以后每次改动 static 文件,把?v=递增即可。验证
go build/go vet通过?v=2,带查询串请求/static/*仍返回 200(Gin 静态服务忽略 query string)