From ef19ecedb7760617ceb4d215825ab9659c2797ad Mon Sep 17 00:00:00 2001 From: Joaquim Peixoto Date: Fri, 25 Jun 2021 14:54:13 +0100 Subject: CORS FIX --- src/middlewares/Authentication.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'src/middlewares/Authentication.ts') diff --git a/src/middlewares/Authentication.ts b/src/middlewares/Authentication.ts index 4b0f2b38..4b38f1d4 100644 --- a/src/middlewares/Authentication.ts +++ b/src/middlewares/Authentication.ts @@ -21,6 +21,7 @@ declare global { } export async function Authentication(req: Request, res: Response, next: NextFunction) { + if (req.method === "OPTIONS") return res.sendStatus(204); if (!req.url.startsWith("/api")) return next(); if (req.url.startsWith("/api/v8/invites") && req.method === "GET") return next(); if (NO_AUTHORIZATION_ROUTES.some((x) => x.test(req.url))) return next(); -- cgit 1.5.1