-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiddleware.ts
More file actions
29 lines (26 loc) · 857 Bytes
/
Copy pathmiddleware.ts
File metadata and controls
29 lines (26 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
* middleware.ts (root)
*
* Next.js middleware — runs on every request before the page renders.
* Delegates to updateSession() for Supabase auth session refresh
* and route protection.
*
* Matcher excludes static assets, _next internals, and public files.
*/
import { type NextRequest } from 'next/server'
import { updateSession } from '@/utils/supabase/middleware'
export async function middleware(request: NextRequest) {
return await updateSession(request)
}
export const config = {
matcher: [
/*
* Match all request paths EXCEPT:
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon)
* - Static assets (.svg, .png, .jpg, etc.)
*/
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|woff2|ico|json|txt|xml|mp4)$).*)',
],
}