Skip to content

Commit

Permalink
chore: Fix middleware matcher to exclude specific subpaths
Browse files Browse the repository at this point in the history
  • Loading branch information
dvaJi committed Nov 29, 2023
1 parent 3284a6e commit 9d87aa5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function getLocale(request: NextRequest): string | undefined {
export function middleware(request: NextRequest) {
const href = request.nextUrl.href;
const pathname = href.replace(request.nextUrl.origin, "");
console.log(pathname)
console.log(pathname);

// // `/_next/` and `/api/` are ignored by the watcher, but we need to ignore files in `public` manually.
// // If you have one
Expand Down Expand Up @@ -62,5 +62,7 @@ export function middleware(request: NextRequest) {

export const config = {
// Matcher ignoring `/_next/`, `/api/` and `/admin/` subpaths
matcher: ["/((?!api|_next/static|admin|_next/image|favicon.ico).*)"],
matcher: [
"/((?!en/|es/|ja/|cn/|zh-tw/|de/|fr/|id/|it/|ko/|pt/|ru/|th/|tr/|vi/|api|_next/static|admin|_next/image|favicon.ico|sw.js|workbox-[a-zA-Z0-9]+.js).*)",
],
};

1 comment on commit 9d87aa5

@vercel
Copy link

@vercel vercel bot commented on 9d87aa5 Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.