diff --git a/fastify.js b/fastify.js index fcca48d501..1a68a2c8a2 100644 --- a/fastify.js +++ b/fastify.js @@ -308,11 +308,6 @@ function build (options) { } function listenPromise (port, address, backlog) { - // This will listen to what localhost is. - // It can be 127.0.0.1 or ::1, depending on the operating system. - // Fixes https://github.com/fastify/fastify/issues/1022. - address = address || 'localhost' - if (listening) { return Promise.reject(new Error('Fastify is already listening')) } @@ -348,7 +343,11 @@ function build (options) { cb = address address = undefined } - address = address || '127.0.0.1' + + // This will listen to what localhost is. + // It can be 127.0.0.1 or ::1, depending on the operating system. + // Fixes https://github.com/fastify/fastify/issues/1022. + address = address || 'localhost' /* Deal with listen (port, address, cb) */ if (typeof backlog === 'function') {