Here is my latest middleware implementation:
export async function middleware(request: NextRequest) {
const token = request.headers.get('token')
console.log(token)
if (!token || token == undefined) {
return NextResponse.redirect(new URL('/login', request.url))
}
}
export const config = {
matcher: \['/admin/:path\*'\]
}
This is the response from the backend express:
`res.cookie('token', response.token, {
maxAge: maxAges,
httpOnly: false,
secure: process.env.NODE_ENV === 'production',
sameSite: 'none'
})`
The method works fine locally. However, when trying to deploy with HTTPS for both frontend and backend, it does not work as expected.