mirror of
https://github.com/thelounge/thelounge.git
synced 2024-06-29 10:40:35 +02:00
Merge pull request #535 from thelounge/PR/fix-webirc-4in6
Fix webirc and 4-in-6 addresses
This commit is contained in:
commit
f824036225
|
@ -84,11 +84,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) {
|
||||||
|
|
Loading…
Reference in a new issue