This commit is contained in:
parent
db1f3de490
commit
6c56252145
@ -10,7 +10,7 @@ const apexinstance = require('./lib/apex'),
|
|||||||
constant = require('./lib/constant'),
|
constant = require('./lib/constant'),
|
||||||
http = require('http'),
|
http = require('http'),
|
||||||
express = require('express'),
|
express = require('express'),
|
||||||
rateLimit = require("express-rate-limit"),
|
rateLimit = require('express-rate-limit'),
|
||||||
app = express(),
|
app = express(),
|
||||||
events = require('events'),
|
events = require('events'),
|
||||||
{ generateKeyPairSync } = require('crypto'),
|
{ generateKeyPairSync } = require('crypto'),
|
||||||
@ -131,11 +131,11 @@ app.set('json spaces', 2)
|
|||||||
app.set('trust proxy', true)
|
app.set('trust proxy', true)
|
||||||
logger(app)
|
logger(app)
|
||||||
app.use(rateLimit({
|
app.use(rateLimit({
|
||||||
windowMs: 5 * 60 * 1000, // 5 minutes
|
windowMs: 1 * 60 * 1000, // 1 minutes
|
||||||
limit: 10, // each IP can make up to 10 requests per `windowsMs` (5 minutes)
|
limit: 120, // each IP can make up to 120 requests per `windowsMs` (5 minutes)
|
||||||
standardHeaders: true, // add the `RateLimit-*` headers to the response
|
standardHeaders: true, // add the `RateLimit-*` headers to the response
|
||||||
legacyHeaders: false,
|
legacyHeaders: false,
|
||||||
delayAfter: 10, // allow 10 requests per `windowMs` (5 minutes) without slowing them down
|
delayAfter: 30, // allow 30 requests per `windowMs` (5 minutes) without slowing them down
|
||||||
delayMs: (hits) => hits * 200, // add 200 ms of delay to every request after the 10th
|
delayMs: (hits) => hits * 200, // add 200 ms of delay to every request after the 10th
|
||||||
maxDelayMs: 5000
|
maxDelayMs: 5000
|
||||||
}))
|
}))
|
||||||
|
Loading…
Reference in New Issue
Block a user