fix: enable gzipped responses with the legacy handler (#23805) (#23806)

re-enable gzip compression on the legacy handler, as it was supported in
influxdb 1.x.

Co-authored-by: Cyril Bonté <cyril.bonte@fr.clara.net>
pull/23836/head
Cyril Bonté 2022-10-20 15:24:05 +02:00 committed by GitHub
parent fa393ccb59
commit 81e2ec617d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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),
}
}