spee.ch/server/utils/isRequestLocal.js

7 lines
231 B
JavaScript
Raw Permalink Normal View History

2018-11-11 01:11:12 +01:00
module.exports = function (req) {
let reqIp = req.connection.remoteAddress;
let host = req.get('host');
2018-10-24 10:43:30 +02:00
2018-11-11 01:11:12 +01:00
return reqIp === '127.0.0.1' || reqIp === '::ffff:127.0.0.1' || reqIp === '::1' || host.indexOf('localhost') !== -1;
};