diff options
author | Alan Pearce | 2024-06-28 20:55:03 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-28 20:55:03 +0200 |
commit | 0fb7d2fdcb5ad199915dbe16d7e06d3f04c67eae (patch) | |
tree | c817bdd920cf4ca63bd06ead56632bc9349d74ae /internal | |
parent | d7fbcb869165b0346c6c942ee04bfb61a8e8177c (diff) | |
download | website-0fb7d2fdcb5ad199915dbe16d7e06d3f04c67eae.tar.lz website-0fb7d2fdcb5ad199915dbe16d7e06d3f04c67eae.tar.zst website-0fb7d2fdcb5ad199915dbe16d7e06d3f04c67eae.zip |
remove h2c support
Diffstat (limited to 'internal')
-rw-r--r-- | internal/server/server.go | 28 |
1 files changed, 1 insertions, 27 deletions
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, |