Skip to content

Commit

Permalink
Fix IP issue by checking CF header (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dengar66 authored Sep 26, 2023
1 parent 48028bd commit b797b9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/controllers/FlairController.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module.exports = {
var blockReport = _.isEqual(flairs.fcs, req.user.loggedFriendCodes.slice(0, flairs.fcs.length));

var flagged = _.reject(flairs.fcs, Flairs.validFC);
var ipAddress = req.headers['x-forwarded-for'] || req.ip;
var ipAddress = req.headers['cf-connecting-ip'] || req.headers['x-forwarded-for'] || req.ip;
// Get IP matches with banned users
var events_with_ip = await Event.find({content: RegExp('IP: '+ipAddress.replace(/\./,'\\.')+'$'), user: {not: req.user.name}});

Expand Down

0 comments on commit b797b9b

Please sign in to comment.