diff --git a/next.config.mjs b/next.config.mjs index 5850805..ab1b307 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { output: "standalone", + basePath: "/subman", webpack: (config) => { config.externals = [...config.externals, "bcrypt"]; return config; diff --git a/src/middleware.ts b/src/middleware.ts index 5fd702c..d4c4f72 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -17,7 +17,7 @@ export default async function(request: NextRequest): Promise | und const url = request.nextUrl.clone() - url.pathname = "/login" + url.pathname = "subman/login" url.searchParams.set('from', request.nextUrl.pathname) if (protectedRoutes.some(pattern => matchesWildcard(request.nextUrl.pathname, pattern))) { const token = request.cookies.get('token') @@ -47,7 +47,7 @@ export default async function(request: NextRequest): Promise | und //TODO - TEST THIS BECAUSE IT PROBABLY DOESN'T WORK //redirect from login if already logged in let redirectToApp = false - if (request.nextUrl.pathname === "/login") { + if (request.nextUrl.pathname === "subman/login") { const token = request.cookies.get("token") if (token) { try {