fix sub-host cli handling
This commit is contained in:
+1
-2
@@ -18,8 +18,7 @@ const argv = optimist
|
||||
describe: 'listen on this port for outside requests'
|
||||
})
|
||||
.options('sub-host', {
|
||||
describe: 'additionally listen on these sub hosts for outside requests',
|
||||
type: 'array'
|
||||
describe: 'additionally listen on this sub host for outside requests (can use this option multiple times)'
|
||||
})
|
||||
.options('max-sockets', {
|
||||
default: 10,
|
||||
|
||||
@@ -50,6 +50,8 @@ function maybe_bounce(req, res, sock, head, opt) {
|
||||
let subdomain = tldjs.getSubdomain(hostname);
|
||||
|
||||
if (subdomain && opt.subHost) {
|
||||
const subHosts = Array.isArray(opt.subHost)
|
||||
? opt.subHost : [opt.subHost]
|
||||
const subHost = opt.subHost.reduce((found, sub) => {
|
||||
return found
|
||||
|| (subdomain.slice(-sub.length) == sub ? sub : '')
|
||||
|
||||
Reference in New Issue
Block a user