According to the docs, creating a server can optionally listen to a specific host:
server.listen(port, [host], [backlog], [callback])
Begin accepting connections on the specified
portandhost. If thehostis omitted, the server will accept connections directed to any IPv4 address (INADDR_ANY).
So you can listen to a single host, or to any host.
Is there a way to listen to a few specific hosts?
req.headers.hostand respond with a 404 for all but the ones you'd like to respond to.