mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
ListenBucketNotification should set proper MIME type. (#4621)
This is needed to avoid proxies buffering the connection this is also a HTTP standard way to handle this situation where server is sending back events in asynchronously. For more details read https://goo.gl/RCML9f Fixes - https://github.com/minio/minio-go/issues/731
This commit is contained in:
parent
344f9ec608
commit
4e0c08e9c5
@ -204,6 +204,15 @@ func writeNotification(w http.ResponseWriter, notification map[string][]Notifica
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// https://github.com/containous/traefik/issues/560
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
|
||||
//
|
||||
// Proxies might buffer the connection to avoid this we
|
||||
// need the proper MIME type before writing to client.
|
||||
// This MIME header tells the proxies to avoid buffering
|
||||
w.Header().Set("Content-Type", "text/event-stream")
|
||||
|
||||
// Add additional CRLF characters for client to
|
||||
// differentiate the individual events properly.
|
||||
_, err = w.Write(append(notificationBytes, crlf...))
|
||||
|
Loading…
Reference in New Issue
Block a user