Skip to content

Commit c0f3bf6

Browse files
mmmrayFangliding
andcommitted
Add new header to disable HTTP middle box buffer
Co-Authored-By: 风扇滑翔翼 <[email protected]>
1 parent e4f9d03 commit c0f3bf6

File tree

1 file changed

+3
-0
lines changed
  • transport/internet/splithttp

1 file changed

+3
-0
lines changed

transport/internet/splithttp/hub.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
161161

162162
// magic header instructs nginx + apache to not buffer response body
163163
writer.Header().Set("X-Accel-Buffering", "no")
164+
// magic header to make the HTTP middle box consider this as SSE to disable buffer
165+
writer.Header().Set("Content-Type", "text/event-stream")
166+
164167
writer.WriteHeader(http.StatusOK)
165168
// send a chunk immediately to enable CDN streaming.
166169
// many CDN buffer the response headers until the origin starts sending

0 commit comments

Comments
 (0)