diff options
author | Alan Pearce | 2024-05-24 20:13:25 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-24 20:15:23 +0200 |
commit | b65aa0a6d8c735763cfb237db2b158b892abf77c (patch) | |
tree | 310bd7ac7daa19a687065d533226c72b4f95d847 | |
parent | f1269cec2d85f21823f1d79eda5d6e29fa2a0cfa (diff) | |
download | website-b65aa0a6d8c735763cfb237db2b158b892abf77c.tar.lz website-b65aa0a6d8c735763cfb237db2b158b892abf77c.tar.zst website-b65aa0a6d8c735763cfb237db2b158b892abf77c.zip |
server: support h2c
-rw-r--r-- | fly.toml | 2 | ||||
-rw-r--r-- | internal/server/server.go | 15 |
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 } |