其他分享
首页 > 其他分享> > 让pomelo可以获取到反向代理websockets的真实用户IP

让pomelo可以获取到反向代理websockets的真实用户IP

作者:互联网

/home/pomelo/livegame/game-server/node_modules/pomelo/lib/connectors

找到

var Socket = function(id, socket) {

//ws模式,过滤IPV4前面的无用IPV6头
var ip = socket._socket.remoteAddress.replace(/::ffff:/, '');
var realIp = socket.upgradeReq.headers['x-forwarded-for'] || socket.upgradeReq.headers['x-real-ip'] || ip
this.remoteAddress = {
ip: ip,
port: socket._socket.remotePort,
realIp: realIp
};

标签:socket,remoteAddress,IP,pomelo,ip,var,realIp,websockets
来源: https://www.cnblogs.com/xiami2046/p/12676086.html