Next.js Discord

Discord Forum

NextResponse Set-Cookie multiple keys

Unanswered
Nile Crocodile posted this in #help-forum
Open in Discord
Nile CrocodileOP
Nextjs is struggling because it cannot put multiple set-cookies in the header
The object has only one key, but the setCookie must be able to define multiple keys

I want to know how to do that

return NextResponse.redirect(url, {
  headers: {
    'Set-Cookie': res.headers.getSetCookie()[0],
    'Set-Cookie': res2.headers.getSetCookie[0],
},
})

1 Reply