fix: lates
Some checks are pending
CI - Production Readiness / Verify (push) Waiting to run

This commit is contained in:
2026-04-21 20:37:59 +07:00
parent f48c87e36d
commit 137edc12b7
15 changed files with 846 additions and 23 deletions

View File

@ -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"