diff options
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | internal/server/server.go | 28 |
2 files changed, 2 insertions, 28 deletions
diff --git a/go.mod b/go.mod index d669148..ba85a41 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,6 @@ require ( github.com/thessem/zap-prettyconsole v0.5.0 github.com/yuin/goldmark v1.7.4 go.uber.org/zap v1.27.0 - golang.org/x/net v0.26.0 ) require ( @@ -94,6 +93,7 @@ require ( golang.org/x/crypto/x509roots/fallback v0.0.0-20240624163532-1c7450041f58 // indirect golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/mod v0.18.0 // indirect + golang.org/x/net v0.26.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.21.0 // indirect golang.org/x/term v0.21.0 // indirect diff --git a/internal/server/server.go b/internal/server/server.go index f922f6d..9dcf09f 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -21,8 +21,6 @@ import ( "github.com/ardanlabs/conf/v3" "github.com/osdevisnot/sorvor/pkg/livereload" "github.com/pkg/errors" - "golang.org/x/net/http2" - "golang.org/x/net/http2/h2c" ) var ( @@ -83,25 +81,6 @@ func updateCSPHashes(config *cfg.Config, r *builder.Result) { func serverHeaderHandler(wrappedHandler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - log.Debug( - "headers", - "proto", - r.Header.Get("X-Forwarded-Proto"), - "host", - r.Header.Get("X-Forwarded-Host"), - "scheme", - r.URL.Scheme, - "secure", - r.TLS != nil, - ) - log.Debug("host", "request", r.Host, "header", r.Header.Get("Host")) - if r.ProtoMajor >= 2 && r.Header.Get("Host") != "" { - // net/http does this for HTTP/1.1, but not h2c - // TODO: check with HTTP/2.0 (i.e. with TLS) - log.Debug("host", "request", r.Host, "header", r.Header.Get("Host")) - r.Host = r.Header.Get("Host") - r.Header.Del("Host") - } w.Header().Set("Server", serverHeader) wrappedHandler.ServeHTTP(w, r) }) @@ -223,12 +202,7 @@ func New(runtimeConfig *Config) (*Server, error) { WriteTimeout: 2 * time.Minute, IdleTimeout: 10 * time.Minute, Addr: listenAddress, - Handler: http.MaxBytesHandler(h2c.NewHandler( - top, - &http2.Server{ - IdleTimeout: 15 * time.Minute, - }, - ), 0), + Handler: top, }, redirectHandler: redirectHandler, config: config, |