From 42ad2cef2297159aea13f948200daae2a91ab696 Mon Sep 17 00:00:00 2001 From: Tommaso De Rossi Date: Thu, 14 Sep 2023 17:30:56 +0200 Subject: [PATCH] Set standalone server default hostname to `0.0.0.0` (#54445) By default Next.js listens on localhost, platforms like Google Cloud Run and fly.io will fail to deploy apps that listen on `localhost`, Next.js should bind to `0.0.0.0` instead Related to #54342 Fixes #49777 Fixes #54133 --- packages/next/src/build/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/src/build/utils.ts b/packages/next/src/build/utils.ts index 1e973c50d3ae2..ea34d4e7028d4 100644 --- a/packages/next/src/build/utils.ts +++ b/packages/next/src/build/utils.ts @@ -1984,7 +1984,7 @@ if (!process.env.NEXT_MANUAL_SIG_HANDLE) { } const currentPort = parseInt(process.env.PORT, 10) || 3000 -const hostname = process.env.HOSTNAME || 'localhost' +const hostname = process.env.HOSTNAME || '0.0.0.0' let keepAliveTimeout = parseInt(process.env.KEEP_ALIVE_TIMEOUT, 10) const nextConfig = ${JSON.stringify({