fix(certd-server): 调整首页缓存控制头的判断逻辑

新增对首页路径 / 和 /index.html 的强制不缓存处理,确保首页始终获取最新内容
This commit is contained in:
xiaojunnuo
2026-05-20 00:21:42 +08:00
parent cb08e061d2
commit 0499347588
@@ -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');
}
});