configure for subdomain
Gitea/subman-nextjs/pipeline/head This commit looks good Details

This commit is contained in:
andrzej 2024-10-04 11:15:30 +02:00
parent 5fb913b6a3
commit 4716264483
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: "standalone", output: "standalone",
// basePath: "/subman", basePath: "/subman",
webpack: (config) => { webpack: (config) => {
config.externals = [...config.externals, "bcrypt"]; config.externals = [...config.externals, "bcrypt"];
return config; return config;

View File

@ -17,7 +17,7 @@ export default async function(request: NextRequest): Promise<NextResponse> | und
const url = request.nextUrl.clone() const url = request.nextUrl.clone()
url.pathname = "subman/login" url.pathname = "/login"
url.searchParams.set('from', request.nextUrl.pathname) url.searchParams.set('from', request.nextUrl.pathname)
if (protectedRoutes.some(pattern => matchesWildcard(request.nextUrl.pathname, pattern))) { if (protectedRoutes.some(pattern => matchesWildcard(request.nextUrl.pathname, pattern))) {
const token = request.cookies.get('token') const token = request.cookies.get('token')
@ -47,7 +47,7 @@ export default async function(request: NextRequest): Promise<NextResponse> | und
//TODO - TEST THIS BECAUSE IT PROBABLY DOESN'T WORK //TODO - TEST THIS BECAUSE IT PROBABLY DOESN'T WORK
//redirect from login if already logged in //redirect from login if already logged in
let redirectToApp = false let redirectToApp = false
if (request.nextUrl.pathname === "subman/login") { if (request.nextUrl.pathname === "/login") {
const token = request.cookies.get("token") const token = request.cookies.get("token")
if (token) { if (token) {
try { try {