This commit is contained in:
@ -3,6 +3,7 @@ import { NextResponse, type NextRequest } from "next/server";
|
||||
import { canAccessPath, getDefaultPathForRole, parseSessionCookie, SESSION_COOKIE, type UserRole } from "@/lib/auth";
|
||||
import { DEFAULT_LOCALE, isLocale, LOCALE_COOKIE } from "@/lib/i18n";
|
||||
import { getRequestBaseUrl } from "@/lib/request-url";
|
||||
import { getSessionCookieDomain } from "@/lib/auth";
|
||||
|
||||
const AUTH_DEBUG = process.env.AUTH_DEBUG === "true" || process.env.AUTH_DEBUG === "1";
|
||||
|
||||
@ -73,6 +74,7 @@ export async function middleware(request: NextRequest) {
|
||||
const detected = acceptLanguage.includes("id") ? "id" : acceptLanguage.includes("en") ? "en" : DEFAULT_LOCALE;
|
||||
response.cookies.set(LOCALE_COOKIE, detected, {
|
||||
path: "/",
|
||||
domain: getSessionCookieDomain(),
|
||||
maxAge: 365 * 24 * 60 * 60,
|
||||
secure: shouldUseSecureCookies(request),
|
||||
sameSite: "lax"
|
||||
@ -80,6 +82,7 @@ export async function middleware(request: NextRequest) {
|
||||
} else if (!isLocale(localeCookie)) {
|
||||
response.cookies.set(LOCALE_COOKIE, DEFAULT_LOCALE, {
|
||||
path: "/",
|
||||
domain: getSessionCookieDomain(),
|
||||
maxAge: 365 * 24 * 60 * 60,
|
||||
secure: shouldUseSecureCookies(request),
|
||||
sameSite: "lax"
|
||||
|
||||
Reference in New Issue
Block a user