From b1afb54b52740c6b187fca4c1b5387aef3de6329 Mon Sep 17 00:00:00 2001 From: R van der Feer Date: Mon, 17 Oct 2022 21:46:33 +0200 Subject: [PATCH] Middleware matcher example I had to use an adjusted regex to match the static files, and an additional '/' to match the app root. --- docs/advanced-features/middleware.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/advanced-features/middleware.md b/docs/advanced-features/middleware.md index 24955cfa1936..0ebda482d2ca 100644 --- a/docs/advanced-features/middleware.md +++ b/docs/advanced-features/middleware.md @@ -92,12 +92,13 @@ The `matcher` config allows full regex so matching like negative lookaheads or c export const config = { matcher: [ /* - * Match all request paths except for the ones starting with: - * - api (API routes) - * - static (static files) - * - favicon.ico (favicon file) + * Match all request paths except for: + * - /api (API routes) + * - /_next/static (static files) + * - /favicon.ico (favicon file) */ - '/((?!api|static|favicon.ico).*)', + '/', + '/((?!api|_next/static|favicon.ico).*)'], ], } ```