Reputation: 29508
Is it possible to determine the domain name for an incoming request using the NodeJS net API?
For example, could the following code be modified to allow me to access the domain name?
net.createServer(function (socket) {
socket.on('data', function (data) {
// Possible to get incoming domain name?
});
socket.on('end', function () {
// Possible to get incoming domain name?
});
}).listen(6000);
Upvotes: 0
Views: 1123
Reputation: 888203
TCP requests have nothing to do with domain names.
The information you're looking for does not exist anywhere.
The only reason this is possible in HTTP is that the client explicitly sends the domain name in the Host:
header.
Upvotes: 4