Files
forumlify/next.config.js
T
lezi-fun 1486d95f89 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.
2026-08-10 10:15:16 +08:00

25 lines
742 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** @type {import('next').NextConfig} */
const nextConfig = {
// Docker 部署用 standalone 输出;serverless(Vercel/CF Pages)不需要
...(process.env.DOCKER ? { output: 'standalone' } : {}),
// /uploads/* 由 API 路由提供(上传文件运行时新增,不进 public 构建快照)
async rewrites() {
return [
{ 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;