Authored by 刘志远

Merge branch 'feature/del-privateIps' into 'master'

加上ip 限制

加上ip 限制

See merge request !108
@@ -5,7 +5,7 @@ module.exports = (req, res, next) => { @@ -5,7 +5,7 @@ module.exports = (req, res, next) => {
5 try { 5 try {
6 const privateIps = _.get(req, 'app.locals.yap.json.privateips', []); 6 const privateIps = _.get(req, 'app.locals.yap.json.privateips', []);
7 7
8 - logger.info(`privateIps: ${privateIps.join(',')}`); 8 + logger.info(`privateIps: ${privateIps.join(' | ')}`);
9 if (_.includes(privateIps, req.yoho.clientIp) || _.get(req, 'app.locals.devEnv', false) || 9 if (_.includes(privateIps, req.yoho.clientIp) || _.get(req, 'app.locals.devEnv', false) ||
10 _.get(req, 'app.locals.isTest', false)) { 10 _.get(req, 'app.locals.isTest', false)) {
11 return next(); 11 return next();
@@ -15,5 +15,6 @@ module.exports = (req, res, next) => { @@ -15,5 +15,6 @@ module.exports = (req, res, next) => {
15 } 15 }
16 16
17 logger.warn(`[privateips warn], ${req.yoho.clientIp}`); 17 logger.warn(`[privateips warn], ${req.yoho.clientIp}`);
18 - return next(); 18 + return res.status(401).end();
  19 +
19 }; 20 };