From bd156ebb536a42b941a821149dcdcb2904de75cd Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 14 Jan 2025 10:42:41 +0100 Subject: [PATCH] Add X-Accel-Buffering to disable buffers in proxies (#5544) --- supervisor/api/host.py | 1 + supervisor/api/ingress.py | 1 + supervisor/api/proxy.py | 1 + 3 files changed, 3 insertions(+) diff --git a/supervisor/api/host.py b/supervisor/api/host.py index 81739f0bb..5a67d3b45 100644 --- a/supervisor/api/host.py +++ b/supervisor/api/host.py @@ -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 diff --git a/supervisor/api/ingress.py b/supervisor/api/ingress.py index d9574ace3..a816e3cf7 100644 --- a/supervisor/api/ingress.py +++ b/supervisor/api/ingress.py @@ -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) diff --git a/supervisor/api/proxy.py b/supervisor/api/proxy.py index 3e63c333d..26d532641 100644 --- a/supervisor/api/proxy.py +++ b/supervisor/api/proxy.py @@ -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)