debug domain

This commit is contained in:
sijinhui 2024-08-09 18:18:34 +08:00
parent b0a53d9f6c
commit 39c96dce59
2 changed files with 16 additions and 15 deletions

View File

@ -131,21 +131,21 @@ export const authOptions: NextAuthOptions = {
},
adapter: PrismaAdapter(prisma),
session: { strategy: "jwt", maxAge: 3 * 24 * 60 * 60 },
cookies: {
sessionToken: {
name: `${SECURE_COOKIES ? "__Secure-" : ""}next-auth.session-token`,
options: {
httpOnly: true,
sameSite: "lax",
path: "/",
// When working on localhost, the cookie domain must be omitted entirely (https://stackoverflow.com/a/1188145)
// domain: VERCEL_DEPLOYMENT
// ? `.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}`
// : undefined,
secure: SECURE_COOKIES,
},
},
},
// cookies: {
// sessionToken: {
// name: `${SECURE_COOKIES ? "__Secure-" : ""}next-auth.session-token`,
// options: {
// httpOnly: true,
// sameSite: "lax",
// path: "/",
// // When working on localhost, the cookie domain must be omitted entirely (https://stackoverflow.com/a/1188145)
// // domain: VERCEL_DEPLOYMENT
// // ? `.${process.env.NEXT_PUBLIC_ROOT_DOMAIN}`
// // : undefined,
// secure: SECURE_COOKIES,
// },
// },
// },
callbacks: {
jwt: async ({ token, user }) => {
// const current_time = Math.floor(Date.now() / 1000);

View File

@ -11,6 +11,7 @@ export default async function middleware(req: NextRequest) {
const path = `${url.pathname}${
searchParams.length > 0 ? `?${searchParams}` : ""
}`;
console.log('----', url)
// 直接将/app/下面路由重定向到顶层
if (path.startsWith('/app')) {
return NextResponse.redirect(new URL(path.replace('/app', ''), req.url), 301);