History

fix: avoid buffering of server sent events by proxies (#10164)

Harshavardhana committed 6 years ago

Commit 25a55ba1 parent fe157165 files · +25 −13Browse files

Showing the changes to cmd/api-headers.go (1 of 5 files). Show all

Unified · Split

cmd/api-headers.go+7−0
@@ -38,6 +38,13 @@ func mustGetRequestID(t time.Time) string { · 37 unmodified lines
3838 return fmt.Sprintf("%X", t.UnixNano())
3939 }
4040
41+// setEventStreamHeaders to allow proxies to avoid buffering proxy responses
42+func setEventStreamHeaders(w http.ResponseWriter) {
43+ w.Header().Set(xhttp.ContentType, "text/event-stream")
44+ w.Header().Set(xhttp.CacheControl, "no-cache") // nginx to turn off buffering
45+ w.Header().Set("X-Accel-Buffering", "no") // nginx to turn off buffering
46+}
47+
4148 // Write http common headers
4249 func setCommonHeaders(w http.ResponseWriter) {
4350 w.Header().Set(xhttp.ServerInfo, "MinIO/"+ReleaseTag)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t