From b65aa0a6d8c735763cfb237db2b158b892abf77c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 24 May 2024 20:13:25 +0200 Subject: server: support h2c --- internal/server/server.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'internal') diff --git a/internal/server/server.go b/internal/server/server.go index 3b90038..9038c04 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -16,6 +16,8 @@ import ( "github.com/getsentry/sentry-go" sentryhttp "github.com/getsentry/sentry-go/http" "github.com/pkg/errors" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" ) var config *cfg.Config @@ -105,11 +107,16 @@ func New(runtimeConfig *Config) (*Server, error) { &http.Server{ Addr: listenAddress, ReadHeaderTimeout: 1 * time.Minute, - Handler: sentryHandler.Handle( - serverHeaderHandler( - wrapHandlerWithLogging(top), + Handler: http.MaxBytesHandler(h2c.NewHandler( + sentryHandler.Handle( + serverHeaderHandler( + wrapHandlerWithLogging(top), + ), ), - ), + &http2.Server{ + IdleTimeout: 15 * time.Minute, + }, + ), 0), }, }, nil } -- cgit 1.4.1