Skip to content

Commit

Permalink
setup a timeout to avoid slowloris attacks
Browse files Browse the repository at this point in the history
  • Loading branch information
kpacha committed Oct 1, 2024
1 parent 7066008 commit bc83810
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions exporter/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ func Exporter(ctx context.Context, cfg opencensus.Config) (*prometheus.Exporter,
router := http.NewServeMux()
router.Handle("/metrics", exporter)
server := http.Server{
Handler: router,
Addr: fmt.Sprintf(":%d", cfg.Exporters.Prometheus.Port),
Handler: router,
Addr: fmt.Sprintf(":%d", cfg.Exporters.Prometheus.Port),
ReadHeaderTimeout: 3 * time.Second,
}

go func() {
Expand Down

0 comments on commit bc83810

Please sign in to comment.