Skip to content

Commit

Permalink
Merge pull request thelounge#535 from thelounge/PR/fix-webirc-4in6
Browse files Browse the repository at this point in the history
Fix webirc and 4-in-6 addresses
  • Loading branch information
astorije authored Aug 12, 2016
2 parents 49b43d3 + a8a4105 commit 498f81c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,15 @@ module.exports = function() {
};

function getClientIp(req) {
var ip;

if (!Helper.config.reverseProxy) {
return req.connection.remoteAddress;
ip = req.connection.remoteAddress;
} 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) {
Expand Down

0 comments on commit 498f81c

Please sign in to comment.