Skip to content

Commit

Permalink
Merge pull request #82 from krakend/avoid_slowloris
Browse files Browse the repository at this point in the history
setup a timeout to avoid slowloris attacks
  • Loading branch information
kpacha authored Oct 1, 2024
2 parents 9565b94 + bc83810 commit 8d6fbb8
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 8d6fbb8

Please sign in to comment.