Попытка заставить iisnode и socket.io работать (отлично работает на linux). Я использую Sticky session для использования нескольких процессоров.iisnode get remoteAddress
Теперь при запуске через iisnode у меня возникают проблемы с удаленным IP-адресом от клиента.
Похоже, что connection.headers пуст. Что мне не хватает?
var server = net.createServer({ pauseOnConnect: true }, function (connection) {
// Incoming request processing
// We received a connection and need to pass it to the appropriate
// worker. Get the worker for this connection's source IP and pass
// it the connection.
var remote = connection.remoteAddress; // this returns undefined
var local = connection.localAddress; // this returns undefined
var ip = (remote + local).match(/[0-9]+/g)[0].replace(/,/g, '');
var wIndex = ip % num_processes;
var worker = workers[wIndex];
console.log("Message to work "+ worker+", remote: "+ remote+ ", local: "+ local+", ip: "+ ip +", index: "+ wIndex);
worker.send('sticky-session:connection', connection);
});
Update: При использовании паузы {pauseOnConnect: истинный} вы не можете получить доступ к заголовкам.