Skip to content

Commit c538ee9

Browse files
HenryHengZJ0xi4o
authored andcommitted
Bugfix/Add header to allow sse on nginx (#3214)
add header to allow sse on nginx
1 parent 1e28a71 commit c538ee9

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Diff for: packages/server/src/controllers/internal-predictions/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const createAndStreamInternalPrediction = async (req: Request, res: Response, ne
2727
res.setHeader('Content-Type', 'text/event-stream')
2828
res.setHeader('Cache-Control', 'no-cache')
2929
res.setHeader('Connection', 'keep-alive')
30+
res.setHeader('X-Accel-Buffering', 'no') //nginx config: https://serverfault.com/a/801629
3031
res.flushHeaders()
3132

3233
const apiResponse = await utilBuildChatflow(req, true)

Diff for: packages/server/src/controllers/predictions/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const createPrediction = async (req: Request, res: Response, next: NextFunction)
6363
res.setHeader('Content-Type', 'text/event-stream')
6464
res.setHeader('Cache-Control', 'no-cache')
6565
res.setHeader('Connection', 'keep-alive')
66+
res.setHeader('X-Accel-Buffering', 'no') //nginx config: https://serverfault.com/a/801629
6667
res.flushHeaders()
6768

6869
const apiResponse = await predictionsServices.buildChatflow(req)

0 commit comments

Comments
 (0)