Bugfix/Add header to allow sse on nginx (#3214)

add header to allow sse on nginx
This commit is contained in:
Henry Heng
2024-09-18 16:15:52 +01:00
committed by GitHub
parent 793319c9ae
commit a2911d2aaf
2 changed files with 2 additions and 0 deletions
@@ -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)
@@ -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)