Closed Ucok23 closed 2 weeks ago
The next-auth docs about protecting route in getting started section resulting middleware relative urls error
import { auth } from "./auth" export default auth((req) => { if (!req.auth) { return NextResponse.redirect("/login") } })
NextResponse.redirect(url) url should be absolute url i think
NextResponse.redirect(url)
https://authjs.dev/getting-started/session-management/protecting
Fix in the docs: https://authjs.dev/getting-started/session-management/protecting#nextjs-middleware
In short, you can replace the current URLs pathname.
What is the improvement or update you wish to see?
The next-auth docs about protecting route in getting started section resulting middleware relative urls error
Is there any context that might help us understand?
NextResponse.redirect(url)
url should be absolute url i thinkDoes the docs page already exist? Please link to it.
https://authjs.dev/getting-started/session-management/protecting