From 0499347588ee544862420ab9a5afd2546d61bc6c Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Wed, 20 May 2026 00:21:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(certd-server):=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=BC=93=E5=AD=98=E6=8E=A7=E5=88=B6=E5=A4=B4?= =?UTF-8?q?=E7=9A=84=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增对首页路径 / 和 /index.html 的强制不缓存处理,确保首页始终获取最新内容 --- packages/ui/certd-server/src/configuration.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/ui/certd-server/src/configuration.ts b/packages/ui/certd-server/src/configuration.ts index 13ee49993..26f9e6473 100644 --- a/packages/ui/certd-server/src/configuration.ts +++ b/packages/ui/certd-server/src/configuration.ts @@ -124,7 +124,9 @@ export class MainConfiguration { this.app.getMiddleware().insertFirst(async (ctx: IMidwayKoaContext, next: NextFunction) => { await next(); - if (shouldSetDefaultNoCache(ctx.path, ctx.response.get('Cache-Control'))) { + const path = ctx.path; + // 如果是首页则强制设置为不缓存 + if (path === '/' || path === '/index.html' || shouldSetDefaultNoCache(path, ctx.response.get('Cache-Control')) ) { ctx.response.set('Cache-Control', 'public,max-age=0'); } });