Skip to content

🎧 Your Personal Streaming Service

Add Nginx header to not buffer SSE connection

Deluanabaecf2b88c4
diff --git a/server/events/sse.go b/server/events/sse.go
index 8ce5a678b..e9d04eb89 100644
--- a/server/events/sse.go
+++ b/server/events/sse.go
@@ -120,6 +120,8 @@ func (b *broker) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-transform")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("Access-Control-Allow-Origin", "*")
+ // Tells Nginx to not buffer this response. See https://stackoverflow.com/a/33414096
+ w.Header().Set("X-Accel-Buffering", "no")
// Each connection registers its own message channel with the Broker's connections registry
c := b.subscribe(r)