Add request ip to request object (#4265)
* add the client ip to the request config object * add the config ip to the trigger request object * add the config ip to the functions request object * add tests * remove log * remove log
This commit is contained in:
committed by
Florent Vilmart
parent
9376b4d04a
commit
70ad9e9ffd
@@ -106,12 +106,15 @@ export function handleParseHeaders(req, res, next) {
|
||||
req.body = new Buffer(base64, 'base64');
|
||||
}
|
||||
|
||||
const clientIp = getClientIp(req);
|
||||
|
||||
info.app = AppCache.get(info.appId);
|
||||
req.config = new Config(info.appId, mount);
|
||||
req.config.headers = req.headers || {};
|
||||
req.config.ip = clientIp;
|
||||
req.info = info;
|
||||
|
||||
if (info.masterKey && req.config.masterKeyIps && req.config.masterKeyIps.length !== 0 && req.config.masterKeyIps.indexOf(getClientIp(req)) === -1) {
|
||||
if (info.masterKey && req.config.masterKeyIps && req.config.masterKeyIps.length !== 0 && req.config.masterKeyIps.indexOf(clientIp) === -1) {
|
||||
return invalidRequest(req, res);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user