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 | 8 |
4 files changed, 4 insertions, 10 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..795e2249 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") + useHTTP2 = 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'") @@ -48,14 +48,12 @@ 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 && server.TLSConfig != nil { + // 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") } - if !a.config.General.HTTP2 { - server.TLSNextProto = make(map[string]func(*http.Server, *tls.Conn, http.Handler)) - } - l, err := net.FileListener(os.NewFile(config.fd, "[socket]")) if err != nil { return fmt.Errorf("failed to listen on FD %d: %v", config.fd, err) |