diff --git a/backend/src/server/plugins/maintenanceMode.ts b/backend/src/server/plugins/maintenanceMode.ts index f40f1ff6d..201dd05b8 100644 --- a/backend/src/server/plugins/maintenanceMode.ts +++ b/backend/src/server/plugins/maintenanceMode.ts @@ -5,8 +5,13 @@ import { getConfig } from "@app/lib/config/env"; export const maintenanceMode = fp(async (fastify) => { fastify.addHook("onRequest", async (req) => { const serverEnvs = getConfig(); - if (req.url !== "/api/v1/auth/checkAuth" && req.method !== "GET" && serverEnvs.MAINTENANCE_MODE) { - throw new Error("Infisical is in maintenance mode. Please try again later."); + if (serverEnvs.MAINTENANCE_MODE) { + // skip if its universal auth login or renew + if (req.url === "/api/v1/auth/universal-auth/login" && req.method === "POST") return; + if (req.url === "/api/v1/auth/token/renew" && req.method === "POST") return; + if (req.url !== "/api/v1/auth/checkAuth" && req.method !== "GET") { + throw new Error("Infisical is in maintenance mode. Please try again later."); + } } }); });