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.
This commit is contained in:
Deluan 2021-04-20 10:16:20 -04:00 committed by Joe Stump
parent f902fa1c59
commit 8241aa0e13
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -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("Cache-Control", "no-cache, no-transform")
w.Header().Set("Connection", "keep-alive") w.Header().Set("Connection", "keep-alive")
w.Header().Set("Access-Control-Allow-Origin", "*") 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 // Each connection registers its own message channel with the Broker's connections registry
c := b.subscribe(r) c := b.subscribe(r)