Why I cannot access cookies in middleware in Nextjs
I have a middleware sitting between the client and /api/Blog/[id]/route.js async function GET(){…}
Next middleware doesn’t pass cookies returned from server
I have a Django backend that returns an httpOnly cookie on successful login. This cookie is required for accessing protected routes in the Next app. I have a middleware that checks if a protected route is being accessed – if it is, then an api call is made to ensure that the user can access said page. Here’s the code for that –
Unable to access Response cookies in NextJS middleware
I’m having trouble accessing the cookies of a Response object in NextJS middleware.