Next.js Discord

Discord Forum

Nextjs + Supabase middleware matcher for homepage

Unanswered
Gharial posted this in #help-forum
Open in Discord
GharialOP
was following the flow for nextjs https://supabase.com/docs/guides/auth/server-side/nextjs, and got all the files set up. The problem I'm having is with matcher for middleware. For the homepage it keeps redirection to login. I'm trying to figure out what the correct matcher is.

With the example

export const config = {
    matcher: [
        "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
    ],
};


I also added

export const config = {
    matcher: [
        "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)",
                "/",
    ],
};


But wouldn't work. Any idea what the correct regex expression I should add?

0 Replies