fix(server): no cache

This commit is contained in:
RainbowBird
2026-03-30 19:45:43 +08:00
parent 2caae8ee41
commit 33bf61f3f7
2 changed files with 19 additions and 0 deletions
+10
View File
@@ -74,6 +74,16 @@ async function buildApp(deps: AppDeps) {
const logger = useLogger('app').useGlobalConfig()
const app = new Hono<HonoEnv>()
.use('*', async (c, next) => {
await next()
// NOTICE: All API responses should be non-cacheable. Auth responses can
// carry session state through redirects, and stale API payloads are not
// safe to serve from edge caches after user/account mutations.
c.res.headers.set('Cache-Control', 'no-store, no-cache, private, max-age=0')
c.res.headers.set('Pragma', 'no-cache')
c.res.headers.set('Expires', '0')
})
.use(
'/api/*',
cors({