mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2026-05-17 08:36:55 +03:00
lib/httpserver: prefer gzip over zstd compression for http responses if the client indicates it supports both methods
This is needed because some clients and proxies improperly handle zstd-compressed responses. See https://github.com/VictoriaMetrics/victoriametrics-datasource/issues/455 . Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10535
This commit is contained in:
@@ -273,7 +273,14 @@ func stop(addr string) error {
|
||||
}
|
||||
|
||||
var gzipHandlerWrapper = func() func(http.Handler) http.HandlerFunc {
|
||||
hw, err := gzhttp.NewWrapper(gzhttp.CompressionLevel(1))
|
||||
hw, err := gzhttp.NewWrapper(
|
||||
gzhttp.CompressionLevel(1),
|
||||
|
||||
// Prefer gzip over zstd compression if the client supports both methods
|
||||
// because some intermediate proxies improperly handle zstd-compressed responses.
|
||||
// See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/10535
|
||||
gzhttp.PreferZstd(false),
|
||||
)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("BUG: cannot initialize gzip http wrapper: %w", err))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user