From 3a85ad05e0f976b4fb920b0591343fe6426fe720 Mon Sep 17 00:00:00 2001 From: Jaz Date: Sat, 21 Sep 2024 23:39:30 -0700 Subject: [PATCH] Use a header that won't get rewritten by a reverse-proxy --- cmd/jetstream/server.go | 4 ++-- pkg/client/client.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/jetstream/server.go b/cmd/jetstream/server.go index 774c860..aac0ad3 100644 --- a/cmd/jetstream/server.go +++ b/cmd/jetstream/server.go @@ -311,8 +311,8 @@ func (s *Server) HandleSubscribe(c echo.Context) error { } // Check if the user wants zstd compression - acceptEncoding := c.Request().Header.Get("Accept-Encoding") - compress := strings.Contains(acceptEncoding, "zstd") + socketEncoding := c.Request().Header.Get("Socket-Encoding") + compress := strings.Contains(socketEncoding, "zstd") var cursor *int64 var err error diff --git a/pkg/client/client.go b/pkg/client/client.go index f748e8b..25d8ca7 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -64,7 +64,7 @@ func NewClient(config *ClientConfig, logger *slog.Logger, scheduler Scheduler) ( } if config.Compress { - c.config.ExtraHeaders["Accept-Encoding"] = "zstd" + c.config.ExtraHeaders["Socket-Encoding"] = "zstd" dec, err := zstd.NewReader(nil, zstd.WithDecoderDicts(models.ZSTDDictionary)) if err != nil { return nil, fmt.Errorf("failed to create zstd decoder: %w", err)