Next.js Discord

Discord Forum

Http-Only Cookies are not send along with the request made through API route handler

Unanswered
Bonga shad posted this in #help-forum
Open in Discord
Bonga shadOP
I Have two files

api.js
app/api/generateToken/route.js

I'm running my Nextjs app in localhost:3000 and I have NestJs server running on localhost:3001

I've set the cookie in the with http-only flag enabled in localhost domain.

When I make request from api.js file to app/api/generateToken/route.js I'm getting the cookies in the header. But, when I try to make api request from app/api/generateToken/route.js to my NestJS server I'm not getting the cookies in the headers.

i've also used middleware which is not working for me.

Should I manually add the cookies in the headers of the request which is made from the API routes. If, yes I have more than 20 routing folder in a the app/api.

Could someone help me with solving this problem.

0 Replies