...
|
...
|
@@ -20,14 +20,17 @@ const limiter = (rule, policy, context) => { |
|
|
|
|
|
module.exports = (req, res, next) => {
|
|
|
let remoteIp = req.get('X-Forwarded-For') || req.connection.remoteAddress;
|
|
|
logger.debug('request remote ip: ', remoteIp);
|
|
|
|
|
|
if (remoteIp.indexOf(',') > 0) {
|
|
|
let arr = remoteIp.split(',');
|
|
|
|
|
|
remoteIp = arr[0];
|
|
|
remoteIp = arr[arr.length - 1];
|
|
|
}
|
|
|
|
|
|
remoteIp = _.trim(remoteIp);
|
|
|
|
|
|
logger.info('request remote ip: ', remoteIp);
|
|
|
|
|
|
const excluded = _.includes(IP_WHITE_LIST, remoteIp);
|
|
|
const enabled = !_.get(req.app.locals, 'wap.sys.noLimiter');
|
|
|
|
...
|
...
|
|