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.
This commit is contained in:
Jonny Rhea 2026-05-28 02:30:08 -05:00 committed by GitHub
parent ab20d50dba
commit b0df33967c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View file

@ -739,7 +739,7 @@ func signer(c *cli.Context) error {
if err != nil { if err != nil {
utils.Fatalf("Could not register API: %w", err) 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 // set port
port := c.Int(rpcPortFlag.Name) port := c.Int(rpcPortFlag.Name)

View file

@ -148,7 +148,7 @@ func newHandler(stack *node.Node, backend ethapi.Backend, filterSystem *filters.
return nil, err return nil, err
} }
h := handler{Schema: s} 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{})
stack.RegisterHandler("GraphQL UI", "/graphql/ui/", GraphiQL{}) stack.RegisterHandler("GraphQL UI", "/graphql/ui/", GraphiQL{})

View file

@ -445,6 +445,7 @@ func (n *Node) startRPC() error {
Vhosts: n.config.AuthVirtualHosts, Vhosts: n.config.AuthVirtualHosts,
Modules: DefaultAuthModules, Modules: DefaultAuthModules,
prefix: DefaultAuthPrefix, prefix: DefaultAuthPrefix,
disableGzip: true,
rpcEndpointConfig: sharedConfig, rpcEndpointConfig: sharedConfig,
}) })
if err != nil { if err != nil {

View file

@ -42,6 +42,7 @@ type httpConfig struct {
CorsAllowedOrigins []string CorsAllowedOrigins []string
Vhosts []string Vhosts []string
prefix string // path prefix on which to mount http handler prefix string // path prefix on which to mount http handler
disableGzip bool
rpcEndpointConfig rpcEndpointConfig
} }
@ -320,7 +321,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error {
} }
h.httpConfig = config h.httpConfig = config
h.httpHandler.Store(&rpcHandler{ 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, prefix: config.prefix,
server: srv, server: srv,
}) })
@ -402,13 +403,16 @@ func isWebsocket(r *http.Request) bool {
} }
// NewHTTPHandlerStack returns wrapped http-related handlers // 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 // Wrap the CORS-handler within a host-handler
handler := newCorsHandler(srv, cors) handler := newCorsHandler(srv, cors)
handler = newVHostHandler(vhosts, handler) handler = newVHostHandler(vhosts, handler)
if len(jwtSecret) != 0 { if len(jwtSecret) != 0 {
handler = newJWTHandler(jwtSecret, handler) handler = newJWTHandler(jwtSecret, handler)
} }
if disableGzip {
return handler
}
return newGzipHandler(handler) return newGzipHandler(handler)
} }