v0.3.1: 修复仪表盘缓存问题 + 版本号同步
- 修复: admin.html 无缓存, /assets/ immutable + 1年缓存 - 修复: 清理过期 index-Bz21yOih.js 残留文件 - 版本: VERSION → 0.3.1 (唯一来源)
This commit is contained in:
@@ -42,6 +42,15 @@ app.use(rateLimiter);
|
||||
|
||||
// ============ 前端静态文件 ============
|
||||
const frontendDist = path.join(__dirname, 'frontend');
|
||||
// Cache control: HTML no-cache, hashed assets immutable
|
||||
app.use((req, res, next) => {
|
||||
if (req.path.endsWith('.html')) {
|
||||
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
|
||||
} else if (req.path.startsWith('/assets/')) {
|
||||
res.setHeader('Cache-Control', 'public, max-age=31536000, immutable');
|
||||
}
|
||||
next();
|
||||
});
|
||||
app.use(express.static(frontendDist));
|
||||
|
||||
// ============ Routes ============
|
||||
|
||||
Reference in New Issue
Block a user