...
|
...
|
@@ -10,9 +10,9 @@ const captchaPolicy = require('./policies/captcha'); |
|
|
const reporterPolicy = require('./policies/reporter');
|
|
|
|
|
|
const IP_WHITE_LIST = [
|
|
|
|
|
|
// '106.38.38.146',
|
|
|
// '218.94.75.58'
|
|
|
'106.38.38.146',
|
|
|
'218.94.75.58',
|
|
|
'218.94.75.50'
|
|
|
];
|
|
|
|
|
|
const limiter = (rule, policy, context) => {
|
...
|
...
|
@@ -20,7 +20,7 @@ const limiter = (rule, policy, context) => { |
|
|
};
|
|
|
|
|
|
module.exports = (req, res, next) => {
|
|
|
let remoteIp = req.get('X-Forwarded-For') || req.connection.remoteAddress;
|
|
|
let remoteIp = req.get('X-Forwarded-For') || req.get('X-Real-IP') || '';
|
|
|
|
|
|
if (remoteIp.indexOf(',') > 0) {
|
|
|
let arr = remoteIp.split(',');
|
...
|
...
|
@@ -30,6 +30,10 @@ module.exports = (req, res, next) => { |
|
|
|
|
|
remoteIp = _.trim(remoteIp);
|
|
|
|
|
|
if (_.startsWith(remoteIp, '10.66.')) {
|
|
|
remoteIp = req.get('X-Real-IP');
|
|
|
}
|
|
|
|
|
|
logger.info('request remote ip: ', remoteIp);
|
|
|
|
|
|
const excluded = _.includes(IP_WHITE_LIST, remoteIp);
|
...
|
...
|
|