Cookies are not kept in the browser after redirect
Answered
Black Caiman posted this in #help-forum
Black CaimanOP
Hi, I have a Next.JS 14.1 project which has a login page.
The login is sending the request to a remote server that is written in Python and receives a cookie,
the cookie is well received and stored in the browser, but after I redirect the user to "domain.com/app" the cookie is deleted and the user is redirected back to login page.
the redirecting is happening in a Next.JS middleware that validate the cookie against the server.
i don't understand why the cookie is always deleted, did anyone encountered the same issue?
The login is sending the request to a remote server that is written in Python and receives a cookie,
the cookie is well received and stored in the browser, but after I redirect the user to "domain.com/app" the cookie is deleted and the user is redirected back to login page.
the redirecting is happening in a Next.JS middleware that validate the cookie against the server.
i don't understand why the cookie is always deleted, did anyone encountered the same issue?
Answered by Black Caiman
The problem was that i made a request to "127.0.0.1:port" instead of "localhost:port" 🤮
1 Reply
Black CaimanOP
The problem was that i made a request to "127.0.0.1:port" instead of "localhost:port" 🤮
Answer