Fix webirc and 4-in-6 addresses

This commit is contained in:
Maxime Poulin 2016-07-30 20:54:09 -04:00
parent a7fe19deca
commit d42ac23c55
No known key found for this signature in database
GPG Key ID: CB63C36252F40D4B

View File

@ -70,11 +70,15 @@ module.exports = function() {
}; };
function getClientIp(req) { function getClientIp(req) {
var ip;
if (!Helper.config.reverseProxy) { if (!Helper.config.reverseProxy) {
return req.connection.remoteAddress; ip = req.connection.remoteAddress;
} else { } else {
return req.headers["x-forwarded-for"] || req.connection.remoteAddress; ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress;
} }
return ip.replace(/^::ffff:/, "");
} }
function allRequests(req, res, next) { function allRequests(req, res, next) {