Next (13.2.4) not redirect in build mode after set cookie
Unanswered
Ratonero Valenciano posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Ratonero ValencianoOP
'm trying to authorize through cookies and middleware. In dev mode, everything works fine. But in the assembly (npm run build) the redirect does not work after the cookies are set. I do not understand why in dev mode everything works as it should, but in the build the redirect does not work. In this case, cookies appear
![Image](https://cdn.discordapp.com/attachments/1130778147592347740/1130778148175364166/Screenshot_20230718_170606.png)
![Image](https://cdn.discordapp.com/attachments/1130778147592347740/1130778148536066078/Screenshot_20230718_170656.png)
![Image](https://cdn.discordapp.com/attachments/1130778147592347740/1130778148800315443/Screenshot_20230718_170623.png)
5 Replies
![Avatar](https://cdn.discordapp.com/avatars/184479429404262410/a_35db4fb943e84d39bb02d6ec0f1d0b7e.gif?size=256)
DirtyCajunRice | AppDir
you need to return the redirects
no idea why that even works in dev
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Ratonero ValencianoOP
If I return a redirect, then I have an infinite redirect. Only works if I return NextResponse.next()
![Avatar](https://cdn.discordapp.com/avatars/184479429404262410/a_35db4fb943e84d39bb02d6ec0f1d0b7e.gif?size=256)
DirtyCajunRice | AppDir
then you arent redirecting. you either return next OR redirect. you need to fix your logic.
![Avatar](https://cdn.discordapp.com/embed/avatars/1.png)
Ratonero ValencianoOP
Thx, bro. I fixed this â¤ï¸