From 1486d95f891e66325b74e2b27333575a1fbbc885 Mon Sep 17 00:00:00 2001 From: lezi-fun <177434121+lezi-fun@users.noreply.github.com> Date: Mon, 10 Aug 2026 10:15:16 +0800 Subject: [PATCH] fix: no-cache HTML headers (dynamic forum content) Next.js default s-maxage=31536000 caches HTML for a year at CDN level, serving stale pages after deploys. Add Cache-Control: no-store for all routes so CDN/browser always fetch fresh. --- next.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/next.config.js b/next.config.js index a6e87b4..7d5fdc5 100644 --- a/next.config.js +++ b/next.config.js @@ -8,6 +8,17 @@ const nextConfig = { { source: '/uploads/:name', destination: '/api/uploads/:name' }, ]; }, + // 论坛是动态内容:HTML 页面不缓存,避免 CDN/浏览器拿到旧版本 + async headers() { + return [ + { + source: '/:path*', + headers: [ + { key: 'Cache-Control', value: 'no-cache, no-store, must-revalidate' }, + ], + }, + ]; + }, }; module.exports = nextConfig;