diff --git a/src/handlers/handlerUtils.ts b/src/handlers/handlerUtils.ts index 92e9c4bf..363a0f44 100644 --- a/src/handlers/handlerUtils.ts +++ b/src/handlers/handlerUtils.ts @@ -34,6 +34,7 @@ import { import { env } from 'hono/adapter'; import { OpenAIChatCompleteJSONToStreamResponseTransform } from '../providers/openai/chatComplete'; import { OpenAICompleteJSONToStreamResponseTransform } from '../providers/openai/complete'; +import { getRuntimeKey } from 'hono/adapter'; /** * Constructs the request options for the API call. @@ -946,6 +947,9 @@ export function updateResponseHeaders( // Brotli compression causes errors at runtime, removing the header in that case response.headers.delete('content-encoding'); } + if (getRuntimeKey() == 'node') { + response.headers.delete('content-encoding'); + } // Delete content-length header to avoid conflicts with hono compress middleware // workerd environment handles this authomatically diff --git a/src/index.ts b/src/index.ts index 7573f8e9..f852f67e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,7 +33,7 @@ const app = new Hono(); app.use('*', (c, next) => { const runtime = getRuntimeKey(); - if (runtime !== 'lagon' && runtime !== 'workerd') { + if (runtime !== 'lagon' && runtime !== 'workerd' && runtime !== 'node') { return compress()(c, next); } return next();