Skip to content

Commit 7f8d659

Browse files
Remove gzip middleware from API server (#4005)
1 parent a52b9e9 commit 7f8d659

File tree

3 files changed

+2
-11
lines changed

3 files changed

+2
-11
lines changed

api/server/server.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"path"
1313
"time"
1414

15-
"github.com/NYTimes/gziphandler"
1615
"github.com/prometheus/client_golang/prometheus"
1716
"github.com/rs/cors"
1817
"go.uber.org/zap"
@@ -117,11 +116,10 @@ func New(
117116
}
118117

119118
router := newRouter()
120-
handler := wrapHandler(router, nodeID, allowedOrigins, allowedHosts, true)
119+
handler := wrapHandler(router, nodeID, allowedOrigins, allowedHosts)
121120

122121
http2Router := newHTTP2Router()
123-
// Do not use gzip middleware because it breaks the grpc spec
124-
http2Handler := wrapHandler(http2Router, nodeID, allowedOrigins, allowedHosts, false)
122+
http2Handler := wrapHandler(http2Router, nodeID, allowedOrigins, allowedHosts)
125123

126124
httpServer := &http.Server{
127125
Handler: h2c.NewHandler(
@@ -333,16 +331,12 @@ func wrapHandler(
333331
nodeID ids.NodeID,
334332
allowedOrigins []string,
335333
allowedHosts []string,
336-
gzip bool,
337334
) http.Handler {
338335
h := filterInvalidHosts(handler, allowedHosts)
339336
h = cors.New(cors.Options{
340337
AllowedOrigins: allowedOrigins,
341338
AllowCredentials: true,
342339
}).Handler(h)
343-
if gzip {
344-
h = gziphandler.GzipHandler(h)
345-
}
346340
return http.HandlerFunc(
347341
func(w http.ResponseWriter, r *http.Request) {
348342
// Attach this node's ID as a header

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ go 1.23.9
1111

1212
require (
1313
github.com/DataDog/zstd v1.5.2
14-
github.com/NYTimes/gziphandler v1.1.1
1514
github.com/StephenButtolph/canoto v0.15.0
1615
github.com/antithesishq/antithesis-sdk-go v0.3.8
1716
github.com/ava-labs/coreth v0.15.2-rc.0

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec/go.mod h1
5252
github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY=
5353
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
5454
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
55-
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
56-
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
5755
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
5856
github.com/StephenButtolph/canoto v0.15.0 h1:3iGdyTSQZ7/y09WaJCe0O/HIi53ZyTrnmVzfCqt64mM=
5957
github.com/StephenButtolph/canoto v0.15.0/go.mod h1:IcnAHC6nJUfQFVR9y60ko2ecUqqHHSB6UwI9NnBFZnE=

0 commit comments

Comments
 (0)