Skip to content

Commit

Permalink
Bugfix/Add header to allow sse on nginx (#3214)
Browse files Browse the repository at this point in the history
add header to allow sse on nginx
  • Loading branch information
HenryHengZJ authored and 0xi4o committed Sep 30, 2024
1 parent 1e28a71 commit c538ee9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const createAndStreamInternalPrediction = async (req: Request, res: Response, ne
res.setHeader('Content-Type', 'text/event-stream')
res.setHeader('Cache-Control', 'no-cache')
res.setHeader('Connection', 'keep-alive')
res.setHeader('X-Accel-Buffering', 'no') //nginx config: https://serverfault.com/a/801629
res.flushHeaders()

const apiResponse = await utilBuildChatflow(req, true)
Expand Down
1 change: 1 addition & 0 deletions packages/server/src/controllers/predictions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const createPrediction = async (req: Request, res: Response, next: NextFunction)
res.setHeader('Content-Type', 'text/event-stream')
res.setHeader('Cache-Control', 'no-cache')
res.setHeader('Connection', 'keep-alive')
res.setHeader('X-Accel-Buffering', 'no') //nginx config: https://serverfault.com/a/801629
res.flushHeaders()

const apiResponse = await predictionsServices.buildChatflow(req)
Expand Down

0 comments on commit c538ee9

Please sign in to comment.