Ā© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago•
13 replies
boogsh

Supabase Middleware not working

Hello, my middleware on my app is not working, i think, i am just checking to see if the middleware will redirect me '/' to '/dashboard' thats it. BUT ITS NOT redirecting
CODE:
// middleware.ts
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export function middleware(request: NextRequest) {
// Only redirect if the user is at '/'
if (request.nextUrl.pathname === "/") {
const url = request.nextUrl.clone();
url.pathname = "/dashboard";
return NextResponse.redirect(url);
}

// Otherwise, just continue
return NextResponse.next();
}

// Apply to only '/' path
export const config = {
matcher: ["/"],
};
// middleware.ts
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export function middleware(request: NextRequest) {
// Only redirect if the user is at '/'
if (request.nextUrl.pathname === "/") {
const url = request.nextUrl.clone();
url.pathname = "/dashboard";
return NextResponse.redirect(url);
}

// Otherwise, just continue
return NextResponse.next();
}

// Apply to only '/' path
export const config = {
matcher: ["/"],
};
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Middleware not working at all...
SupabaseSSupabase / help-and-questions
15mo ago
Supabase oauth not working
SupabaseSSupabase / help-and-questions
7mo ago
supabase grafana not working
SupabaseSSupabase / help-and-questions
3y ago
Supabase Auth without middleware
SupabaseSSupabase / help-and-questions
4mo ago