set RateLimit-* headers in api responses

makes it much easier for api clients to handle rate limits rather than having to blindly wait and see if the ratelimit window is up
This commit is contained in:
dumbmoron 2023-07-27 18:54:42 +00:00
parent 38ceb1be77
commit ff85939d51

View File

@ -21,7 +21,7 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
const apiLimiter = rateLimit({ const apiLimiter = rateLimit({
windowMs: 60000, windowMs: 60000,
max: 20, max: 20,
standardHeaders: false, standardHeaders: true,
legacyHeaders: false, legacyHeaders: false,
keyGenerator: (req, res) => sha256(getIP(req), ipSalt), keyGenerator: (req, res) => sha256(getIP(req), ipSalt),
handler: (req, res, next, opt) => { handler: (req, res, next, opt) => {
@ -32,7 +32,7 @@ export function runAPI(express, app, gitCommit, gitBranch, __dirname) {
const apiLimiterStream = rateLimit({ const apiLimiterStream = rateLimit({
windowMs: 60000, windowMs: 60000,
max: 25, max: 25,
standardHeaders: false, standardHeaders: true,
legacyHeaders: false, legacyHeaders: false,
keyGenerator: (req, res) => sha256(getIP(req), ipSalt), keyGenerator: (req, res) => sha256(getIP(req), ipSalt),
handler: (req, res, next, opt) => { handler: (req, res, next, opt) => {