From b0df33967c12bd17ca28f44746df3a1463c72c62 Mon Sep 17 00:00:00 2001 From: Jonny Rhea <5555162+jrhea@users.noreply.github.com> Date: Thu, 28 May 2026 02:30:08 -0500 Subject: [PATCH] node, cmd/clef, graphql: disable gzip on engine API (#35057) Add a disableGzip parameter to NewHTTPHandlerStack and httpConfig. initAuth sets it true so compression is disabled in the engine api. Public HTTP RPC behavior is unchanged. --- cmd/clef/main.go | 2 +- graphql/service.go | 2 +- node/node.go | 1 + node/rpcstack.go | 8 ++++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cmd/clef/main.go b/cmd/clef/main.go index 72dfd5016b..2b54bb14cb 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -739,7 +739,7 @@ func signer(c *cli.Context) error { if err != nil { utils.Fatalf("Could not register API: %w", err) } - handler := node.NewHTTPHandlerStack(srv, cors, vhosts, nil) + handler := node.NewHTTPHandlerStack(srv, cors, vhosts, nil, false) // set port port := c.Int(rpcPortFlag.Name) diff --git a/graphql/service.go b/graphql/service.go index 4d530586a3..b65ac20baf 100644 --- a/graphql/service.go +++ b/graphql/service.go @@ -148,7 +148,7 @@ func newHandler(stack *node.Node, backend ethapi.Backend, filterSystem *filters. return nil, err } h := handler{Schema: s} - handler := node.NewHTTPHandlerStack(h, cors, vhosts, nil) + handler := node.NewHTTPHandlerStack(h, cors, vhosts, nil, false) stack.RegisterHandler("GraphQL UI", "/graphql/ui", GraphiQL{}) stack.RegisterHandler("GraphQL UI", "/graphql/ui/", GraphiQL{}) diff --git a/node/node.go b/node/node.go index 56ecd7d522..9e87337c2d 100644 --- a/node/node.go +++ b/node/node.go @@ -445,6 +445,7 @@ func (n *Node) startRPC() error { Vhosts: n.config.AuthVirtualHosts, Modules: DefaultAuthModules, prefix: DefaultAuthPrefix, + disableGzip: true, rpcEndpointConfig: sharedConfig, }) if err != nil { diff --git a/node/rpcstack.go b/node/rpcstack.go index 1db2ed3f44..bd19b58b84 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -42,6 +42,7 @@ type httpConfig struct { CorsAllowedOrigins []string Vhosts []string prefix string // path prefix on which to mount http handler + disableGzip bool rpcEndpointConfig } @@ -320,7 +321,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error { } h.httpConfig = config h.httpHandler.Store(&rpcHandler{ - Handler: NewHTTPHandlerStack(srv, config.CorsAllowedOrigins, config.Vhosts, config.jwtSecret), + Handler: NewHTTPHandlerStack(srv, config.CorsAllowedOrigins, config.Vhosts, config.jwtSecret, config.disableGzip), prefix: config.prefix, server: srv, }) @@ -402,13 +403,16 @@ func isWebsocket(r *http.Request) bool { } // NewHTTPHandlerStack returns wrapped http-related handlers -func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string, jwtSecret []byte) http.Handler { +func NewHTTPHandlerStack(srv http.Handler, cors []string, vhosts []string, jwtSecret []byte, disableGzip bool) http.Handler { // Wrap the CORS-handler within a host-handler handler := newCorsHandler(srv, cors) handler = newVHostHandler(vhosts, handler) if len(jwtSecret) != 0 { handler = newJWTHandler(jwtSecret, handler) } + if disableGzip { + return handler + } return newGzipHandler(handler) }