Spaces:
Running
Running
fix: remove Transfer-Encoding chunked (illegal in HTTP/2) from SSE response headers
Browse files- src/api/routes/rag.py +2 -4
src/api/routes/rag.py
CHANGED
|
@@ -86,13 +86,11 @@ async def chat_with_rag_stream(
|
|
| 86 |
|
| 87 |
user_id = current_user.id if current_user else None
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
#
|
| 91 |
headers = {
|
| 92 |
"X-Accel-Buffering": "no",
|
| 93 |
"Cache-Control": "no-cache, no-transform",
|
| 94 |
-
"Connection": "keep-alive",
|
| 95 |
-
"Transfer-Encoding": "chunked",
|
| 96 |
}
|
| 97 |
|
| 98 |
return StreamingResponse(
|
|
|
|
| 86 |
|
| 87 |
user_id = current_user.id if current_user else None
|
| 88 |
|
| 89 |
+
# X-Accel-Buffering: no tells HF nginx NOT to buffer — fixes ERR_HTTP2_PROTOCOL_ERROR
|
| 90 |
+
# NOTE: Do NOT set Transfer-Encoding: chunked — it is prohibited in HTTP/2 (RFC 7540 §8.1.2.2)
|
| 91 |
headers = {
|
| 92 |
"X-Accel-Buffering": "no",
|
| 93 |
"Cache-Control": "no-cache, no-transform",
|
|
|
|
|
|
|
| 94 |
}
|
| 95 |
|
| 96 |
return StreamingResponse(
|