rsnext/packages/next/server/dev
Naoyuki Kanezawa b522b94cce
feat(next): Support has match and locale option on middleware config (#39257)
## Feature

As the title, support `has` match, `local`  that works the same with the `rewrites` and `redirects` of next.config.js on middleware config. With this PR, you can write the config like the following:

```js
export const config = {
  matcher: [
    "/foo",
    { source: "/bar" },
    {
      source: "/baz",
      has: [
        {
          type: 'header',
          key: 'x-my-header',
          value: 'my-value',
        }
      ]
    },
    {
      source: "/en/asdf",
      locale: false,
     },
  ]
}
```

Also, fixes https://github.com/vercel/next.js/issues/39428

related https://github.com/vercel/edge-functions/issues/178, https://github.com/vercel/edge-functions/issues/179

- [x] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-08-31 11:23:30 -05:00
..
hot-middleware.ts Remove webpack4 types (#39631) 2022-08-16 09:55:37 +00:00
hot-reloader.ts HMR for client CSS imports (#39916) 2022-08-25 16:40:16 +00:00
next-dev-server.ts feat(next): Support has match and locale option on middleware config (#39257) 2022-08-31 11:23:30 -05:00
on-demand-entry-handler.ts Fix disposing active entries in dev compilers (#39845) 2022-08-23 07:23:43 +00:00
static-paths-worker.ts Add port and hostname options to Next Server (#31858) 2021-11-28 16:48:43 +00:00