From 86bb39347aaa60c75ff6e5f76f9212b78d0fd67a Mon Sep 17 00:00:00 2001 From: mmmray <142015632+mmmray@users.noreply.github.com> Date: Thu, 27 Jun 2024 22:40:37 +0200 Subject: [PATCH 1/2] Make SplitHTTP work under CF Argo --- transport/internet/splithttp/hub.go | 1 + 1 file changed, 1 insertion(+) diff --git a/transport/internet/splithttp/hub.go b/transport/internet/splithttp/hub.go index 5181b19bcf73..9b6b482c7418 100644 --- a/transport/internet/splithttp/hub.go +++ b/transport/internet/splithttp/hub.go @@ -161,6 +161,7 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req // magic header instructs nginx + apache to not buffer response body writer.Header().Set("X-Accel-Buffering", "no") + writer.Header().Set("Content-Type", "text/event-stream") writer.WriteHeader(http.StatusOK) // send a chunk immediately to enable CDN streaming. // many CDN buffer the response headers until the origin starts sending From 314da2b78aea25a0018b6b544d66d43a16a379f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Fri, 28 Jun 2024 15:31:31 +0800 Subject: [PATCH 2/2] Update hub.go --- transport/internet/splithttp/hub.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/transport/internet/splithttp/hub.go b/transport/internet/splithttp/hub.go index 9b6b482c7418..18aeb9ca095f 100644 --- a/transport/internet/splithttp/hub.go +++ b/transport/internet/splithttp/hub.go @@ -161,8 +161,9 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req // magic header instructs nginx + apache to not buffer response body writer.Header().Set("X-Accel-Buffering", "no") - writer.Header().Set("Content-Type", "text/event-stream") writer.WriteHeader(http.StatusOK) + // magic header for cloudflared tunnel + writer.Header().Set("Content-Type", "text/event-stream") // send a chunk immediately to enable CDN streaming. // many CDN buffer the response headers until the origin starts sending // the body, with no way to turn it off.