Skip to content
New issue

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

Rephrase middleware location #38073

Merged
merged 1 commit into from
Jun 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions errors/middleware-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you're using Next.js on Vercel, your existing deploys using Middleware will c

### Summary of changes

- Define a single Middleware file at the root of your project
- Define a single Middleware file next to your `pages` folder
- No need to prefix the file with an underscore
- A custom matcher can be used to define matching routes using an exported config object

Expand All @@ -44,7 +44,7 @@ Based on customer feedback, we have replaced this API with a single root Middlew

### How to upgrade

You should declare **one single Middleware file** in your application, which should be located at the root of the project directory (**not** inside of the `pages` directory), and named **without** an `_` prefix. Your Middleware file can still have either a `.ts` or `.js` extension.
You should declare **one single Middleware file** in your application, which should be located next to the `pages` directory and named **without** an `_` prefix. Your Middleware file can still have either a `.ts` or `.js` extension.

Middleware will be invoked for **every route in the app**, and a custom matcher can be used to define matching filters. The following is an example for a Middleware that triggers for `/about/*` and `/dashboard/:path*`, the custom matcher is defined in an exported config object:

Expand Down