Authored by 姜枫

fix startsWith bug

@@ -20,7 +20,7 @@ const limiter = (rule, policy, context) => { @@ -20,7 +20,7 @@ const limiter = (rule, policy, context) => {
20 }; 20 };
21 21
22 module.exports = (req, res, next) => { 22 module.exports = (req, res, next) => {
23 - let remoteIp = req.get('X-Forwarded-For') || req.connection.remoteAddress; 23 + let remoteIp = req.get('X-Forwarded-For');
24 24
25 if (remoteIp.indexOf(',') > 0) { 25 if (remoteIp.indexOf(',') > 0) {
26 let arr = remoteIp.split(','); 26 let arr = remoteIp.split(',');
@@ -30,7 +30,7 @@ module.exports = (req, res, next) => { @@ -30,7 +30,7 @@ module.exports = (req, res, next) => {
30 30
31 remoteIp = _.trim(remoteIp); 31 remoteIp = _.trim(remoteIp);
32 32
33 - if (_.startWith(remoteIp, '10.66.')) { 33 + if (_.startsWith(remoteIp, '10.66.')) {
34 remoteIp = req.get('X-Real-IP'); 34 remoteIp = req.get('X-Real-IP');
35 } 35 }
36 36