Skip to content

Commit

Permalink
Build latest code
Browse files Browse the repository at this point in the history
  • Loading branch information
pbojinov committed Jun 30, 2022
1 parent ce43688 commit 1251947
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function getClientIpFromXForwardedFor(value) {
return ip;
});

for (var i = forwardedIps.length - 1; i >= 0; i -= 1) {
for (var i = 0; i < forwardedIps.length; i++) {
if (is.ip(forwardedIps[i])) {
return forwardedIps[i];
}
Expand Down Expand Up @@ -107,6 +107,12 @@ function getClientIp(req) {
return req.requestContext.identity.sourceIp;
}

if (req.headers) {
if (is.ip(req.headers['Cf-Pseudo-IPv4'])) {
return req.headers['Cf-Pseudo-IPv4'];
}
}

if (is.existy(req.raw)) {
return getClientIp(req.raw);
}
Expand Down

0 comments on commit 1251947

Please sign in to comment.