read cf requestee IP from the headers first
This commit is contained in:
parent
3e9491e9de
commit
b955d19811
1 changed files with 8 additions and 1 deletions
|
@ -25,7 +25,14 @@ module.exports = async function(req, res, loginInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get users IP for getting location
|
// Get users IP for getting location
|
||||||
let requestIP = req.get('X-Real-IP');
|
// Get cloudflare requestee IP first
|
||||||
|
let requestIP = req.get("cf-connecting-ip");
|
||||||
|
|
||||||
|
// Get IP of requestee since we are probably behind a reverse proxy
|
||||||
|
if (requestIP == null)
|
||||||
|
requestIP = req.get("X-Real-IP");
|
||||||
|
|
||||||
|
// Just get the requestee IP (we are not behind a reverse proxy)
|
||||||
if (requestIP == null)
|
if (requestIP == null)
|
||||||
requestIP = req.remote_addr;
|
requestIP = req.remote_addr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue