adds header to improve nginx compatibility
This commit is contained in:
parent
03616f4bbc
commit
13b6a3d7b8
|
@ -48,6 +48,7 @@ export const handleStreamedResponse: RawResponseBodyHandler = async (
|
||||||
res.setHeader("Content-Type", "text/event-stream");
|
res.setHeader("Content-Type", "text/event-stream");
|
||||||
res.setHeader("Cache-Control", "no-cache");
|
res.setHeader("Cache-Control", "no-cache");
|
||||||
res.setHeader("Connection", "keep-alive");
|
res.setHeader("Connection", "keep-alive");
|
||||||
|
res.setHeader("X-Accel-Buffering", "no");
|
||||||
copyHeaders(proxyRes, res);
|
copyHeaders(proxyRes, res);
|
||||||
res.flushHeaders();
|
res.flushHeaders();
|
||||||
}
|
}
|
||||||
|
|
|
@ -299,6 +299,7 @@ function initStreaming(req: Request) {
|
||||||
res.setHeader("Content-Type", "text/event-stream");
|
res.setHeader("Content-Type", "text/event-stream");
|
||||||
res.setHeader("Cache-Control", "no-cache");
|
res.setHeader("Cache-Control", "no-cache");
|
||||||
res.setHeader("Connection", "keep-alive");
|
res.setHeader("Connection", "keep-alive");
|
||||||
|
res.setHeader("X-Accel-Buffering", "no"); // nginx-specific fix
|
||||||
res.flushHeaders();
|
res.flushHeaders();
|
||||||
res.write("\n");
|
res.write("\n");
|
||||||
res.write(": joining queue\n\n");
|
res.write(": joining queue\n\n");
|
||||||
|
|
Loading…
Reference in New Issue