...
|
...
|
@@ -53,19 +53,7 @@ const limiter = (rule, policy, context) => { |
|
|
};
|
|
|
|
|
|
module.exports = (req, res, next) => {
|
|
|
let remoteIp = req.get('X-Yoho-Real-IP') || req.get('X-Forwarded-For') || req.get('X-Real-IP') || '';
|
|
|
|
|
|
if (remoteIp.indexOf(',') > 0) {
|
|
|
let arr = remoteIp.split(',');
|
|
|
|
|
|
remoteIp = arr[arr.length - 1];
|
|
|
}
|
|
|
|
|
|
if (_.startsWith(remoteIp, '10.66.')) {
|
|
|
remoteIp = req.get('X-Real-IP');
|
|
|
}
|
|
|
|
|
|
remoteIp = _.trim(remoteIp);
|
|
|
let remoteIp = req.yoho.clientIp || '';
|
|
|
|
|
|
// 排除条件:ip白名单/路径白名单/异步请求/登录用户
|
|
|
const excluded = _.includes(IP_WHITE_LIST, remoteIp) ||
|
...
|
...
|
|