Skip to content

Commit 18ef357

Browse files
committed
Add note about http.Server.WriteTimeout and SSE connection
1 parent a7005b2 commit 18ef357

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ func (sc StartConfig) start(ctx stdContext.Context, h http.Handler) error {
109109
ErrorLog: slog.NewLogLogger(logger.Handler(), slog.LevelError),
110110
// defaults for GoSec rule G112 // https://github.com/securego/gosec
111111
// G112 (CWE-400): Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server
112-
ReadTimeout: 30 * time.Second,
112+
ReadTimeout: 30 * time.Second,
113+
// WriteTimeout is a max time allowed to write the response
114+
// IMPORTANT: set this to 0 when using Server-Sent-Events (SSE)
113115
WriteTimeout: 30 * time.Second,
114116
}
115117

0 commit comments

Comments
 (0)