mirror of
https://github.com/distribution/distribution.git
synced 2025-09-20 02:34:27 +00:00
feat: Add HTTP2 for unencrypted HTTP (v3) (#4248)
This commit is contained in:
@@ -20,6 +20,8 @@ import (
|
||||
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
||||
"golang.org/x/crypto/acme"
|
||||
"golang.org/x/crypto/acme/autocert"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
|
||||
"github.com/distribution/distribution/v3/configuration"
|
||||
"github.com/distribution/distribution/v3/health"
|
||||
@@ -158,6 +160,9 @@ func NewRegistry(ctx context.Context, config *configuration.Configuration) (*Reg
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error during open telemetry initialization: %v", err)
|
||||
}
|
||||
if config.HTTP.H2C.Enabled {
|
||||
handler = h2c.NewHandler(handler, &http2.Server{})
|
||||
}
|
||||
handler = otelHandler(handler)
|
||||
|
||||
server := &http.Server{
|
||||
|
Reference in New Issue
Block a user