feat(F-139): completed feature

This commit is contained in:
chattie
2026-08-22 13:12:54 +02:00
parent 58b3fe5fa8
commit 5748c00623
11 changed files with 149 additions and 34 deletions

View File

@@ -19,13 +19,17 @@ export async function GET(req: NextRequest) {
headers: { Cookie: cookies },
});
if (path === 'admin/logs/stream') {
// Pipe SSE directly: Next.js App Router supports ReadableStream passthrough.
// X-Accel-Buffering: no tells any intermediate proxy (nginx) not to buffer.
const headers = new Headers();
headers.set('Content-Type', backendRes.headers.get('content-type') ?? 'text/event-stream');
headers.set('Cache-Control', 'no-cache, no-store, must-revalidate');
headers.set('X-Accel-Buffering', 'no');
// Do NOT set Connection: keep-alive — it is HTTP/1.1 default for persistent
// connections and can confuse proxies that do not expect streaming.
return new Response(backendRes.body, {
status: backendRes.status,
headers: {
'Content-Type': backendRes.headers.get('content-type') ?? 'text/event-stream',
'Cache-Control': backendRes.headers.get('cache-control') ?? 'no-cache',
Connection: 'keep-alive',
},
headers,
});
}
const data = await backendRes.json().catch(() => null);