Menu

1 / 2

Our proxy writes down where you were going on every bounce to the login form, and the login form has never read it

DEV Community: authentication·Daniel Pertu·5 days ago
#QQt5fwWJ
#devtoauthentication#devto#dev#auth#next
Reading 0:00
15s threshold

Every signed-out request for a private page on PubTrivia gets the same treatment, and you can see it from anywhere:

$ curl -s -o /dev/null -w '%{http_code} %{redirect_url}\n' https://pub-trivia.app/dashboard 307 https://pub-trivia.app/login?next = %2Fdashboard

Enter fullscreen mode

Exit fullscreen mode

That next is deliberate. The code that writes it says what it is for:

// Unauthenticated users hitting protected routes → redirect to login, // preserving the original destination for post-login redirect. if ( ! user && ! isPublicRoute ( pathname )) { const url = request . nextUrl . clone () url . pathname = ' /login ' url . searchParams . set ( ' next ' , pathname ) return NextResponse .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.