From 81e2ec617db564fa1d20983476bbf1ad80435260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyril=20Bont=C3=A9?= Date: Thu, 20 Oct 2022 15:24:05 +0200 Subject: [PATCH] fix: enable gzipped responses with the legacy handler (#23805) (#23806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit re-enable gzip compression on the legacy handler, as it was supported in influxdb 1.x. Co-authored-by: Cyril Bonté --- http/platform_handler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/http/platform_handler.go b/http/platform_handler.go index 857383f706..12fa2774de 100644 --- a/http/platform_handler.go +++ b/http/platform_handler.go @@ -4,6 +4,7 @@ import ( "net/http" "strings" + "github.com/NYTimes/gziphandler" "github.com/influxdata/influxdb/v2/http/legacy" "github.com/influxdata/influxdb/v2/kit/feature" kithttp "github.com/influxdata/influxdb/v2/kit/transport/http" @@ -45,12 +46,14 @@ func NewPlatformHandler(b *APIBackend, opts ...APIHandlerOptFn) *PlatformHandler legacyBackend := newLegacyBackend(b) lh := newLegacyHandler(legacyBackend, *legacy.NewHandlerConfig()) + // legacy reponses can optionally be gzip encoded + gh := gziphandler.GzipHandler(lh) return &PlatformHandler{ AssetHandler: assetHandler, DocsHandler: Redoc("/api/v2/swagger.json"), APIHandler: wrappedHandler, - LegacyHandler: legacy.NewInflux1xAuthenticationHandler(lh, b.AuthorizerV1, b.HTTPErrorHandler), + LegacyHandler: legacy.NewInflux1xAuthenticationHandler(gh, b.AuthorizerV1, b.HTTPErrorHandler), } }