From 3e8298d1d4ee4bd7738ce194e01b87bf34b10d68 Mon Sep 17 00:00:00 2001 From: yusing Date: Fri, 24 Apr 2026 11:47:36 +0800 Subject: [PATCH] fix(socketproxy): add Transfer-Encoding: chunked header In goutils commit 5159888197c5a49605495be9b87525fde26c83d1 Copy with an http.ResponseWriter destination no longer flushes after every write unless Content-Type is text/event-stream, or Transfer-Encoding includes chunked without Content-Length. This causes endpoints like /events not being flushed on write, which delays notification like container creation/deletion. This commit enforces flush on every write for socket proxy, which also applies to agents --- socket-proxy/pkg/handler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/socket-proxy/pkg/handler.go b/socket-proxy/pkg/handler.go index adff9c14..237f99c7 100644 --- a/socket-proxy/pkg/handler.go +++ b/socket-proxy/pkg/handler.go @@ -34,7 +34,10 @@ func dockerSocketHandler(socket string) http.HandlerFunc { }, } - return rp.ServeHTTP + return func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Transfer-Encoding", "chunked") + rp.ServeHTTP(w, r) + } } func endpointNotAllowed(w http.ResponseWriter, _ *http.Request) {