diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | internal/config/config.go | 3 | ||||
-rw-r--r-- | internal/config/flags.go | 2 | ||||
-rw-r--r-- | server.go | 10 |
4 files changed, 5 insertions, 11 deletions
@@ -311,7 +311,6 @@ environment variable). Directives are specified in `key=value` format, like: ``` pages-domain=example.com -use-http2=false ``` diff --git a/internal/config/config.go b/internal/config/config.go index bb9f4345..1fe6aa0e 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -47,7 +47,6 @@ type Config struct { type General struct { Domain string DomainConfigurationSource string - HTTP2 bool MaxConns int MetricsAddress string RedirectHTTP bool @@ -188,7 +187,6 @@ func loadConfig() (*Config, error) { General: General{ Domain: strings.ToLower(*pagesDomain), DomainConfigurationSource: *domainConfigSource, - HTTP2: *useHTTP2, MaxConns: *maxConns, MetricsAddress: *metricsAddress, RedirectHTTP: *redirectHTTP, @@ -325,7 +323,6 @@ func LogConfig(config *Config) { "status_path": config.General.StatusPath, "tls-min-version": *tlsMinVersion, "tls-max-version": *tlsMaxVersion, - "use-http-2": config.General.HTTP2, "gitlab-server": config.GitLab.Server, "internal-gitlab-server": config.GitLab.InternalServer, "api-secret-key": *gitLabAPISecretKey, diff --git a/internal/config/flags.go b/internal/config/flags.go index 6617a1ee..5ebffcb9 100644 --- a/internal/config/flags.go +++ b/internal/config/flags.go @@ -12,7 +12,7 @@ var ( pagesRootCert = flag.String("root-cert", "", "The default path to file certificate to serve static pages") pagesRootKey = flag.String("root-key", "", "The default path to file certificate to serve static pages") redirectHTTP = flag.Bool("redirect-http", false, "Redirect pages from HTTP to HTTPS") - useHTTP2 = flag.Bool("use-http2", true, "Enable HTTP2 support") + _ = flag.Bool("use-http2", true, "DEPRECATED: HTTP2 is always enabled for pages") pagesRoot = flag.String("pages-root", "shared/pages", "The directory where pages are stored") pagesDomain = flag.String("pages-domain", "gitlab-example.com", "The domain to serve static pages") artifactsServer = flag.String("artifacts-server", "", "API URL to proxy artifact requests to, e.g.: 'https://gitlab.com/api/v4'") @@ -10,7 +10,6 @@ import ( "github.com/gorilla/context" proxyproto "github.com/pires/go-proxyproto" - "golang.org/x/net/http2" "gitlab.com/gitlab-org/gitlab-pages/internal/netutil" ) @@ -49,11 +48,10 @@ func (a *theApp) listenAndServe(config listenerConfig) error { // create server server := &http.Server{Handler: context.ClearHandler(config.handler), TLSConfig: config.tlsConfig} - if a.config.General.HTTP2 { - err := http2.ConfigureServer(server, &http2.Server{}) - if err != nil { - return err - } + // ensure http2 is enabled even if TLSConfig is not null + // See https://github.com/golang/go/blob/97cee43c93cfccded197cd281f0a5885cdb605b4/src/net/http/server.go#L2947-L2954 + if server.TLSConfig != nil { + server.TLSConfig.NextProtos = append(server.TLSConfig.NextProtos, "h2") } l, err := net.FileListener(os.NewFile(config.fd, "[socket]")) |