fix: set cookie in header on rewrite
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { notFound } from "next/navigation"
|
||||
import { type NextMiddleware, NextResponse } from "next/server"
|
||||
|
||||
import { findLang } from "@/constants/languages"
|
||||
@@ -36,6 +37,8 @@ export const middleware: NextMiddleware = async (request) => {
|
||||
nextUrl
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return notFound()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +72,7 @@ export const middleware: NextMiddleware = async (request) => {
|
||||
{
|
||||
headers: {
|
||||
"Set-Cookie": `webviewToken=${decryptedData}; Secure; HttpOnly; Path=/; SameSite=Strict;`,
|
||||
Cookie: `webviewToken=${decryptedData}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
@@ -81,6 +85,7 @@ export const middleware: NextMiddleware = async (request) => {
|
||||
{
|
||||
headers: {
|
||||
"Set-Cookie": `webviewToken=${decryptedData}; Secure; HttpOnly; Path=/; SameSite=Strict;`,
|
||||
Cookie: `webviewToken=${decryptedData}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user