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.
This commit is contained in:
1 parent
60c21ae0a6
commit
1486d95f89
1 file changed
+11
@@ -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;
|
||||
Reference in new issue
Block a user