From 7a7aa8f2b0887761ef51d66634b1f3bf730c71be Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 31 Aug 2021 21:13:59 -0700 Subject: [PATCH] cmd/derper: also add port 80 timeouts Didn't notice this one in earlier 00b3c1c0422d033a479a2efedbbd239c05dab68c Updates tailscale/corp#2486 Signed-off-by: Brad Fitzpatrick --- cmd/derper/derper.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/derper/derper.go b/cmd/derper/derper.go index c495cfb9f..fc39d52be 100644 --- a/cmd/derper/derper.go +++ b/cmd/derper/derper.go @@ -225,7 +225,13 @@ func main() { return cert, nil } go func() { - err := http.ListenAndServe(":80", certManager.HTTPHandler(tsweb.Port80Handler{Main: mux})) + port80srv := &http.Server{ + Addr: ":80", // the default, but to be explicit + Handler: certManager.HTTPHandler(tsweb.Port80Handler{Main: mux}), + ReadTimeout: 30 * time.Second, + WriteTimeout: 30 * time.Second, + } + err := port80srv.ListenAndServe() if err != nil { if err != http.ErrServerClosed { log.Fatal(err)