From abaecf2b88c48754f1caa3248d83c9ca80994d59 Mon Sep 17 00:00:00 2001 From: Deluan Date: Tue, 20 Apr 2021 10:16:20 -0400 Subject: [PATCH] Add Nginx header to not buffer SSE connection This should allow the Activity Panel, that uses a Server-Side Events/ Event Source connection, to work with default Nginx reverse proxy configuration. --- server/events/sse.go | 2 ++ 1 file changed, 2 insertions(+) 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)