req.cookies NEXTJS Middleware undefined on Production

this my next middleware :

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 response from backend express :

  `res.cookie('token', response.token, { 
    maxAge: maxAges,
    httpOnly: false,
    secure: process.env.NODE_ENV === 'production',
    sameSite: 'none'
  })`

in local this methode is work. but if i try to deploy using https for frontend and backend this methode not working.