about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--fly.toml2
-rw-r--r--internal/server/server.go15
2 files changed, 13 insertions, 4 deletions
diff --git a/fly.toml b/fly.toml
index 5b25a9d..d9d84da 100644
--- a/fly.toml
+++ b/fly.toml
@@ -29,6 +29,8 @@ primary_region = "ams"
     type = "requests"
     hard_limit = 20000
     soft_limit = 15000
+[http_service.http_options]
+  h2_backend = true
 [http_service.http_options.response]
   pristine = true
 [[http_service.checks]]
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
 }