Skip to content

Commit 1d6687b

Browse files
authored
Merge pull request #20 from hsiaoairplane/fix/server-timeouts
Add HTTP server timeouts to harden webhook
2 parents f066d76 + 0ee01c1 commit 1d6687b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,12 @@ func main() {
231231

232232
addr := fmt.Sprintf(":%s", *port)
233233
srv := &http.Server{
234-
Addr: addr,
235-
Handler: http.DefaultServeMux,
234+
Addr: addr,
235+
Handler: http.DefaultServeMux,
236+
ReadHeaderTimeout: 5 * time.Second,
237+
ReadTimeout: 10 * time.Second,
238+
WriteTimeout: 10 * time.Second,
239+
IdleTimeout: 60 * time.Second,
236240
}
237241

238242
level, err := log.ParseLevel(*logLevel)

0 commit comments

Comments
 (0)