From 1826529bc8146d73417675c7e26ed9827a2c990c Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sun, 21 Sep 2025 23:20:48 +0200 Subject: [PATCH] Mark /api/events endpoint as uncachable The content of the events stream is generated live in response to changes done in the system as they occur. It therefore can't be meaningfully cached or stored in any way. Mark the response as uncacheable to prevent potential problems with caches. --- server/api/events.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/api/events.ts b/server/api/events.ts index 4415550..ca3d1a3 100644 --- a/server/api/events.ts +++ b/server/api/events.ts @@ -43,6 +43,7 @@ export default defineEventHandler(async (event) => { // Workaround to properly handle stream errors. See https://github.com/unjs/h3/issues/986 setHeader(event, "Access-Control-Allow-Origin", "*"); setHeader(event, "Content-Type", "text/event-stream"); + setHeader(event, "Cache-Control", "no-store"); pipeline(stream as unknown as NodeJS.ReadableStream, event.node.res, (err) => { /* ignore */ }); event._handled = true; });