/node_modules/pomelo/lib/connectors/hybridsocket.js
找到
var Socket = function(id, socket) {
给remoteAddress对象新增加个realIp属性,从ws对象的握手请求头里找到反向代理发送的用户真实IP头
//ws模式,过滤IPV4前面的无用IPV6头
var ip = socket._socket.remoteAddress;
var realIp = socket.upgradeReq.headers['x-forwarded-for'] || socket.upgradeReq.headers['x-real-ip'] || socket.upgradeReq.headers['X-Client-Address'] || ip;
this.remoteAddress = {
ip: ip.replace(/::ffff:/, ''),
port: socket._socket.remotePort,
realIp: realIp.replace(/::ffff:/, '')
};
/node_modules/pomelo/lib/common/service
再修改pomelo的sessionServer 类的 getClientAddressBySessionId 方法