Add X-Accel-Buffering to disable buffers in proxies (#5544)

This commit is contained in:
Stefan Agner 2025-01-14 10:42:41 +01:00 committed by GitHub
parent b07236b544
commit bd156ebb53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 0 deletions

View File

@ -258,6 +258,7 @@ class APIHost(CoreSysAttributes):
if not headers_returned:
if cursor:
response.headers["X-First-Cursor"] = cursor
response.headers["X-Accel-Buffering"] = "no"
await response.prepare(request)
headers_returned = True
# When client closes the connection while reading busy logs, we

View File

@ -277,6 +277,7 @@ class APIIngress(CoreSysAttributes):
response.content_type = content_type
try:
response.headers["X-Accel-Buffering"] = "no"
await response.prepare(request)
async for data in result.content.iter_chunked(4096):
await response.write(data)

View File

@ -95,6 +95,7 @@ class APIProxy(CoreSysAttributes):
response = web.StreamResponse()
response.content_type = request.headers.get(CONTENT_TYPE)
try:
response.headers["X-Accel-Buffering"] = "no"
await response.prepare(request)
async for data in client.content:
await response.write(data)