-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Update middleware documentation for custom server #33535
Conversation
Upgrading from 12.0.0 to 12.0.8 results in `[dev] error - Error: To use middleware you must provide a `hostname` and `port` to the Next.js Server` and this requirement did not seem to be documented anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding @javivelasco as a reviewer since it looks like this error was introduced in #32368
Co-authored-by: Steven <steven@ceriously.com>
@@ -76,6 +76,18 @@ Middleware runs directly after `redirects` and `headers`, before the first files | |||
|
|||
Middleware uses a [strict runtime](/docs/api-reference/edge-runtime.md) that supports standard Web APIs like `fetch`. This works out of the box using `next start`, as well as on Edge platforms like Vercel, which use [Edge Functions](http://www.vercel.com/edge). | |||
|
|||
## Custom Server | |||
|
|||
When using a custom server with middleware, you must specify the hostname and port when instantiating your `NextApp`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be moved to the Custom Server docs, since it only applies to a very small segment of Next.js users who are ejecting for a custom server.
This moves the note about custom server handling for middleware to the custom server document. ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` x-ref: #33535 (comment)
Upgrading from 12.0.0 to 12.0.8 results in `[dev] error - Error: To use middleware you must provide a `hostname` and `port` to the Next.js Server` and this requirement did not seem to be documented anywhere. Fixes vercel#33450 which seems to have been erroneously closed. ## Bug - [X] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] 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` - [ ] 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` ## Documentation / Examples - [ ] Make sure the linting passes by running `yarn lint` Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
This moves the note about custom server handling for middleware to the custom server document. ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` x-ref: vercel#33535 (comment)
Upgrading from 12.0.0 to 12.0.8 results in
[dev] error - Error: To use middleware you must provide a
hostnameand
portto the Next.js Server
and this requirement did not seem to be documented anywhere. Fixes #33450 which seems to have been erroneously closed.Bug
fixes #number
contributing.md
Feature
fixes #number
contributing.md
Documentation / Examples
yarn lint