Disable http2 connect setting for websocket by default

Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
Co-authored-by: Julien Salleyron <julien.salleyron@gmail.com>
Co-authored-by: Michael <michael.matur@gmail.com>
This commit is contained in:
Romain 2025-01-07 16:12:04 +01:00 committed by GitHub
parent ee8305549a
commit f9ff6049d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View file

@ -23,6 +23,7 @@ import (
"github.com/traefik/traefik/v2/cmd"
"github.com/traefik/traefik/v2/cmd/healthcheck"
cmdVersion "github.com/traefik/traefik/v2/cmd/version"
_ "github.com/traefik/traefik/v2/init"
tcli "github.com/traefik/traefik/v2/pkg/cli"
"github.com/traefik/traefik/v2/pkg/collector"
"github.com/traefik/traefik/v2/pkg/config/dynamic"

21
init/init.go Normal file
View file

@ -0,0 +1,21 @@
package init
import (
"os"
"strings"
)
// This makes use of the GODEBUG flag `http2xconnect` to deactivate the connect setting for HTTP2 by default.
// This type of upgrade is yet incompatible with `net/http` http1 reverse proxy.
// Please see https://github.com/golang/go/issues/71128#issuecomment-2574193636.
func init() {
goDebug := os.Getenv("GODEBUG")
if strings.Contains(goDebug, "http2xconnect") {
return
}
if len(goDebug) > 0 {
goDebug += ","
}
os.Setenv("GODEBUG", goDebug+"http2xconnect=0")
}