Next.js Discord

Discord Forum

Next.js Middleware + Session redirection

Unanswered
Kuchi posted this in #help-forum
Open in Discord
Original message was deleted.

2 Replies

Avatar
Kuchi
I think I have an idea on why its behaving like that

When the middleware runs and satisfies those conditions for alberta
-> redirects to new /AB/pathname
-> middleware runs again.. does the same thing again appending another AB to the existing AB in the url.

There needs to be a check to stop it from running it after redirection.
Maybe a check can be like :

Does the current url have AB already in it? If so, dont run the redirection