fix(middleware): exempt manifest.json and sw.js from the auth matcher

Logged-out requests were redirected to /login, and logged-in non-admin roles
were bounced to their home page, which blocked PWA install and the service
worker.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 08:13:59 +08:00
co-authored by Claude Haiku 4.5
parent 137780d013
commit bbe038e3aa
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -47,5 +47,5 @@ export async function middleware(request: NextRequest) {
}
export const config = {
matcher: ['/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)'],
matcher: ['/((?!_next/static|_next/image|favicon.ico|manifest\\.json$|sw\\.js$|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)'],
}