feat(server): rate limit all routes (#4561)

This commit is contained in:
Apoorv Mishra
2022-12-10 19:17:18 +05:30
committed by GitHub
parent 053d10d893
commit 5c842087a5
3 changed files with 4 additions and 5 deletions

View File

@@ -4,7 +4,6 @@ import Router from "koa-router";
import userAgent, { UserAgentContext } from "koa-useragent";
import env from "@server/env";
import { NotFoundError } from "@server/errors";
import { defaultRateLimiter } from "@server/middlewares/rateLimiter";
import { AuthenticatedState } from "@server/types";
import apiKeys from "./apiKeys";
import attachments from "./attachments";
@@ -89,8 +88,6 @@ router.get("*", (ctx) => {
ctx.throw(NotFoundError("Endpoint not found"));
});
api.use(defaultRateLimiter());
// Router is embedded in a Koa application wrapper, because koa-router does not
// allow middleware to catch any routes which were not explicitly defined.
api.use(router.routes());