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 /internal/server | |
parent | f1269cec2d85f21823f1d79eda5d6e29fa2a0cfa (diff) | |
download | website-b65aa0a6d8c735763cfb237db2b158b892abf77c.tar.lz website-b65aa0a6d8c735763cfb237db2b158b892abf77c.tar.zst website-b65aa0a6d8c735763cfb237db2b158b892abf77c.zip |
server: support h2c
Diffstat (limited to 'internal/server')
-rw-r--r-- | internal/server/server.go | 15 |
1 files changed, 11 insertions, 4 deletions
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 } |