log blocked ip addresses request url

This commit is contained in:
Martin Donnelly 2018-06-14 01:00:11 +01:00
parent 623e42e6d7
commit 8745bf887f

View File

@ -35,12 +35,16 @@ const complexUrls = new Map();
app.use(ipfilter(ips, { 'mode': 'allow' }));
app.use((err, req, res, _next) => {
console.log('Error handler', err);
if(err instanceof IpDeniedError)
const thisErr = Object.assign({},err);
thisErr.originalUrl = req.originalUrl;
console.log('Error handler', thisErr);
console.log(req);
if(thisErr instanceof IpDeniedError)
res.status(401);
else
res.status(err.status || 500);
res.status(thisErr.status || 500);
/* res.render('error', {
'message': 'You shall not pass',