diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index 7ff49f780b..ab5f6e00a5 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -1678,10 +1678,7 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d server.request_pool_allocator = RequestContext.pool.?; // Transfer compression config from ServerConfig to Server - // Disable if onNodeHTTPRequest is set (node:http compatibility) - server.compression_config = if (!config.onNodeHTTPRequest.isEmptyOrUndefinedOrNull()) - null // node:http: always disable compression - else if (config.compression_config_from_js) |comp_config| switch (comp_config) { + server.compression_config = if (config.compression_config_from_js) |comp_config| switch (comp_config) { .use_default => brk: { const default_config = bun.handleOom(bun.default_allocator.create(bun.http.CompressionConfig)); default_config.* = bun.http.CompressionConfig.DEFAULT; diff --git a/src/js/node/_http_server.ts b/src/js/node/_http_server.ts index e40bb70bb5..61c2b227dc 100644 --- a/src/js/node/_http_server.ts +++ b/src/js/node/_http_server.ts @@ -477,6 +477,7 @@ Server.prototype[kRealListen] = function (tls, port, host, socketPath, reusePort } this[serverSymbol] = Bun.serve({ idleTimeout: 0, // nodejs dont have a idleTimeout by default + compression: false, // node:http doesn't support auto-compression tls, port, hostname: host,