perf: 优化/api缓存为0

This commit is contained in:
xiaojunnuo
2025-04-18 15:23:51 +08:00
parent 7daad5477a
commit dc05cd481f
3 changed files with 55 additions and 2 deletions
@@ -96,7 +96,7 @@ export class MainConfiguration {
this.app.getMiddleware().insertFirst(async (ctx: IMidwayKoaContext, next: NextFunction) => {
await next();
if (ctx.path === '/' || ctx.path === '/index.html') {
if (ctx.path === '/' || ctx.path === '/index.html' || ctx.path.startsWith("/api")) {
ctx.response.set('Cache-Control', 'public,max-age=0');
}
});