We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The config sample on middleware docs page states
To match all request paths except for the ones starting with:
export const config = { matcher: ['/((?!api|_next/static|favicon.ico).*)'], };
In my experience, root route /, i. e. homepage is not caught by this regex which I think is expected given the negative look ahead with .*.
/
.*
My workaround is adding a separate matcher:
export const config = { matcher: [ '/((?!api|_next/static|favicon.ico).*)', '/', // explicit matcher for root route ], };
The docs should be more clear about root route excluded from middleware execution.
It's easy to miss it when using the current config sample.
https://vercel.com/docs/functions/edge-middleware/middleware-api#match-based-on-a-negative-lookahead
The text was updated successfully, but these errors were encountered:
this may or may not be a documentation issue.
the extra matcher does work when deployed in Vercel - middleware catches the root route:
however, the extra matcher breaks localhost:
removing the / matcher fixes localhost but then root route is not caught by middleware when deployed.
Sorry, something went wrong.
No branches or pull requests
What is the improvement or update you wish to see?
The config sample on middleware docs page states
In my experience, root route
/
, i. e. homepage is not caught by this regex which I think is expected given the negative look ahead with.*
.My workaround is adding a separate matcher:
The docs should be more clear about root route excluded from middleware execution.
Is there any context that might help us understand?
It's easy to miss it when using the current config sample.
Does the docs page already exist? Please link to it.
https://vercel.com/docs/functions/edge-middleware/middleware-api#match-based-on-a-negative-lookahead
The text was updated successfully, but these errors were encountered: