diff --git a/lib/server.js b/lib/server.js index 64cf79b..c6f373f 100644 --- a/lib/server.js +++ b/lib/server.js @@ -109,11 +109,16 @@ const start = async function start() { address.hostname = address.address; + // fix #131 - server address reported as 127.0.0.1 for localhost + if (address.hostname !== this.options.host && this.options.host === 'localhost') { + address.hostname = this.options.host; + } + // we set this so the client can use the actual hostname of the server. sometimes the net // will mutate the actual hostname value (e.g. :: -> [::]) this.options.address = url.format(address); - const uri = `${protocol}://${url.format(this.options.address)}`; + const uri = `${protocol}://${this.options.address}`; this.log.info('Server Listening on:', uri);