From 82b5f080477b3221f0c34bcafbc41cb63d26b7a6 Mon Sep 17 00:00:00 2001 From: shellscape Date: Fri, 3 May 2019 09:23:49 -0600 Subject: [PATCH] fix: assert localhost when server address doesnt match. fixes #131 --- lib/server.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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);