wizardchen
fb9ae11aa8
fix: 为前端静态资源设置正确的 Cache-Control 响应头
修复升级前端版本后,用户必须退出重新登录才能看到新版页面的问题。
根因:nginx 和 Lite 版 Go 静态服务均未设置 Cache-Control,浏览器按
启发式策略长期缓存 index.html,导致刷新仍加载旧版入口 HTML,旧版
引用的 hash 文件名也就不会变更。
改动:
- frontend/nginx.conf: index.html 及 SPA fallback 设 no-cache,
must-revalidate;/assets/* (Vite 产物带 hash 文件名)设一年
immutable 长缓存。location 内重复声明原有安全头,避免 nginx
add_header 不继承导致安全头丢失。
- internal/router/router.go: Lite 版 serveFrontendStatic 按同样
策略设置 Cache-Control。
2026-05-07 12:08:02 +08:00
..
2026-05-06 11:23:32 +08:00
2026-05-06 17:40:10 +08:00
2026-04-02 21:27:27 +08:00
2026-04-22 21:17:21 +08:00
2026-04-22 21:18:20 +08:00
2026-04-30 11:40:30 +08:00
2026-04-11 18:51:16 +08:00
2026-04-24 13:16:47 +08:00
2025-11-05 23:18:44 +08:00
2026-04-22 21:17:30 +08:00
2026-05-06 17:17:07 +08:00
2026-05-05 00:36:18 +08:00
2026-05-06 22:14:16 +08:00
2026-04-24 10:29:19 +08:00
2026-03-31 11:57:15 +08:00
2026-04-30 11:40:30 +08:00
2026-05-04 23:18:42 +08:00
2026-05-07 12:08:02 +08:00
2025-08-05 15:08:07 +08:00
2026-02-04 20:08:49 +08:00
2026-04-16 23:15:02 +08:00
2026-02-04 19:38:40 +08:00
2026-04-24 13:16:47 +08:00
2026-05-06 21:16:48 +08:00
2026-04-30 15:17:56 +08:00