Apparently headers are always lower case, nice

This commit is contained in:
Madeline
2022-07-02 21:58:52 +10:00
parent 369eca37ed
commit 8ae90ecb03

View File

@@ -84,7 +84,7 @@ app.use((req, res, next) => {
if (requestsThisSecond > allowedRequestsPerSecond)
return res.sendStatus(429);
const ip = (req.headers["X-Forwarded-For"] as string) || req.socket.remoteAddress as string;
const ip = (req.headers["x-forwarded-for"] as string) || req.socket.remoteAddress as string;
console.log(`${ip}`);
if (!rateLimits[ip]) {
rateLimits[ip] = Date.now() + allowRequestsEveryMs;