diff --git a/packages/next/src/executors/server/server.impl.ts b/packages/next/src/executors/server/server.impl.ts index 4fd5d7d976179..8e65b6a4956ce 100644 --- a/packages/next/src/executors/server/server.impl.ts +++ b/packages/next/src/executors/server/server.impl.ts @@ -45,7 +45,11 @@ export default async function* serveExecutor( // Setting port that the custom server should use. process.env.PORT = `${options.port}`; - const args = createCliOptions({ port, keepAliveTimeout, hostname }); + const args = createCliOptions({ port, hostname }); + + if (keepAliveTimeout && !options.dev) { + args.push('--keepAliveTimeout', `${keepAliveTimeout}`); + } const nextDir = resolve(context.root, buildOptions.outputPath);