NextResponse.redirect
Unanswered
West African Crocodile posted this in #help-forum
West African CrocodileOP
Did the API change for how this works?
I'm doing a redirect from a route handler 'api/auth/callback'
But the redirect just leaves me with a 405 on the api/auth/callback route? Instead of redirecting to origin/hidden/dashboard
I'm doing a redirect from a route handler 'api/auth/callback'
return NextResponse.redirect(new URL(`${requestUrl.origin}/hidden/dashboard`), {
status: 307,
})But the redirect just leaves me with a 405 on the api/auth/callback route? Instead of redirecting to origin/hidden/dashboard
3 Replies
Shy Albatross
import { redirect } from "next/navigation";NextResponse.redirect is what you do in the middleware, not in a route handlerWest African CrocodileOP
Cheers