Skip to content

Commit

Permalink
fix: awkward bug in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarneo committed Oct 2, 2021
1 parent fef33f1 commit 9ae5e5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/server/helpers/client-ip.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ module.exports = function getClientIp(headers) {
// Iterate through a list of headers allowed to fetch the ip from
const checkHeaders = [
'do-connecting-ip', // digital ocean app platform
'x-real-ip',
'x-forwarded-for',
];

if (config.get('env') === 'development') {
checkHeaders.push('host');
}

const header = checkHeaders.find((header) => headers[header]);

// return the first existing header
return checkHeaders.find((header) => header in headers);
return headers[header] ? headers[header] : '';
};
// redux

0 comments on commit 9ae5e5d

Please sign in to comment.