I am trying to set the cookie in the getServerSideProps, i am able to read it using `req.headers.cookie but when trying to set it, it doesnt work i tried also using other libraries like cookies-next but it did not persist:
here is the middleware which sets a Cookie and that i am able to read on getServerSideProps:
export function middleware(request: NextRequest) {
const response = NextResponse.next()
response.cookies.set({
name: 'myCookieName',
value: 'some-value',
httpOnly: true,
})
return response
}
my getServerSideProps has nothing except for logs reading the cookie using req.headers.cookie
and attempts to set it. Thanks for taking the time to read this