Next Auth middleware allow "/" but redirect everything else.
Unanswered
Plott Hound posted this in #help-forum
Plott HoundOP
I'm trying to make it so non authenticated users can see the landing page at "/" but any other page takes them to login.
If I use:
I tried using this but it still redirects "/" to login:
Does anyone know how i can do this? Thanks
If I use:
export { default } from "next-auth/middleware"; it will redirect all pages to login.I tried using this but it still redirects "/" to login:
export { default } from "next-auth/middleware";
export const config = {
matcher: (req) => {
if (req.url.startsWith("/_next")) return false;
if (req.url === "/") return false;
return true;
},
};Does anyone know how i can do this? Thanks
1 Reply
Plott HoundOP
Bump