Skip to content

Commit

Permalink
Use a header that won't get rewritten by a reverse-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvolp12 committed Sep 22, 2024
1 parent 836b317 commit 3a85ad0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/jetstream/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3a85ad0

Please sign in to comment.