Skip to content

Commit f940365

Browse files
authored
fix: assert localhost when server address doesnt match. fixes #131 (#132)
1 parent 952a85c commit f940365

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

lib/server.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,16 @@ const start = async function start() {
109109

110110
address.hostname = address.address;
111111

112+
// fix #131 - server address reported as 127.0.0.1 for localhost
113+
if (address.hostname !== this.options.host && this.options.host === 'localhost') {
114+
address.hostname = this.options.host;
115+
}
116+
112117
// we set this so the client can use the actual hostname of the server. sometimes the net
113118
// will mutate the actual hostname value (e.g. :: -> [::])
114119
this.options.address = url.format(address);
115120

116-
const uri = `${protocol}://${url.format(this.options.address)}`;
121+
const uri = `${protocol}://${this.options.address}`;
117122

118123
this.log.info('Server Listening on:', uri);
119124

0 commit comments

Comments
 (0)