's'
This commit is contained in:
@@ -176,3 +176,19 @@ app/lib/
|
|||||||
client.ts # getMinioClient, uploadBuffer, generateObjectKey
|
client.ts # getMinioClient, uploadBuffer, generateObjectKey
|
||||||
index.ts
|
index.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 缓存与部署更新
|
||||||
|
|
||||||
|
项目已配置 `Cache-Control: no-store, no-cache`,部署后用户应能立即看到更新。若使用 **Cloudflare**,还需在控制台调整:
|
||||||
|
|
||||||
|
### Cloudflare 控制台设置
|
||||||
|
|
||||||
|
1. **Caching → Configuration**
|
||||||
|
- **Caching Level**:选 `Standard` 或 `Bypass`(开发/频繁更新时)
|
||||||
|
- **Browser Cache TTL**:选 `Respect Existing Headers`,以遵循源站 `Cache-Control`
|
||||||
|
|
||||||
|
2. **Caching → Cache Rules**(可选)
|
||||||
|
- 为 `/*` 添加规则:`Cache eligibility` = Bypass,或 `Edge TTL` = 0
|
||||||
|
|
||||||
|
3. **DNS**
|
||||||
|
- 记录 **TTL**:设为 `1`(Auto)或 `60` 秒,加快 DNS 变更生效
|
||||||
|
|||||||
@@ -4,6 +4,24 @@ const nextConfig: NextConfig = {
|
|||||||
experimental: {
|
experimental: {
|
||||||
serverActions: { bodySizeLimit: "25mb" },
|
serverActions: { bodySizeLimit: "25mb" },
|
||||||
},
|
},
|
||||||
|
async headers() {
|
||||||
|
const noCacheHeaders = [
|
||||||
|
{
|
||||||
|
key: "Cache-Control",
|
||||||
|
value: "no-store, no-cache, must-revalidate, proxy-revalidate",
|
||||||
|
},
|
||||||
|
{ key: "Pragma", value: "no-cache" },
|
||||||
|
{ key: "Expires", value: "0" },
|
||||||
|
];
|
||||||
|
return [
|
||||||
|
{ source: "/", headers: noCacheHeaders },
|
||||||
|
{
|
||||||
|
// 排除 /_next/ 静态资源(含 hash 可长期缓存),其余页面禁用缓存
|
||||||
|
source: "/:path((?!_next).*)",
|
||||||
|
headers: noCacheHeaders,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nextConfig;
|
export default nextConfig;
|
||||||
|
|||||||
6
public/_headers
Normal file
6
public/_headers
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Cloudflare Pages 自定义响应头(若使用 Cloudflare 部署)
|
||||||
|
# 禁用缓存,部署后用户立即看到更新
|
||||||
|
/*
|
||||||
|
Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate
|
||||||
|
Pragma: no-cache
|
||||||
|
Expires: 0
|
||||||
Reference in New Issue
Block a user