added ip filter
This commit is contained in:
parent
0325a7cdd3
commit
a2a71f7812
573
package-lock.json
generated
573
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@
|
|||||||
"apicache": "^1.1.0",
|
"apicache": "^1.1.0",
|
||||||
"body-parser": "^1.18.2",
|
"body-parser": "^1.18.2",
|
||||||
"express": "^4.16.1",
|
"express": "^4.16.1",
|
||||||
|
"express-ipfilter": "^0.3.1",
|
||||||
"http": "0.0.0",
|
"http": "0.0.0",
|
||||||
"https": "^1.0.0",
|
"https": "^1.0.0",
|
||||||
"log4js": "^2.3.4",
|
"log4js": "^2.3.4",
|
||||||
|
@ -11,6 +11,8 @@ const http = require('http');
|
|||||||
const https = require('https');
|
const https = require('https');
|
||||||
const apicache = require('apicache');
|
const apicache = require('apicache');
|
||||||
|
|
||||||
|
const ipfilter = require('express-ipfilter').IpFilter;
|
||||||
|
|
||||||
const port = process.env.PORT || 8080;
|
const port = process.env.PORT || 8080;
|
||||||
|
|
||||||
logger.level = 'debug';
|
logger.level = 'debug';
|
||||||
@ -24,9 +26,9 @@ const cache = apicache.middleware;
|
|||||||
|
|
||||||
app.use(cache('15 minutes'));
|
app.use(cache('15 minutes'));
|
||||||
|
|
||||||
const ips = [
|
// const ips = ['212.71.255.44', '82.35.75.161'];
|
||||||
|
|
||||||
];
|
const ips = ['212.71.255.44'];
|
||||||
|
|
||||||
const bouncer = ['phpmyadmin',
|
const bouncer = ['phpmyadmin',
|
||||||
'phpMyadmin',
|
'phpMyadmin',
|
||||||
@ -192,6 +194,8 @@ app.get('*', function(req, res, next) {
|
|||||||
next(err);
|
next(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.use(ipfilter(ips, { 'mode': 'allow' }));
|
||||||
|
|
||||||
const server = app.listen(port, () => {
|
const server = app.listen(port, () => {
|
||||||
logger.info(`Server listening on port ${port}`);
|
logger.info(`Server listening on port ${port}`);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user