Skip to content
Merged
Changes from 2 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
13 changes: 13 additions & 0 deletions docs/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ 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`.
Copy link
Contributor

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.


```ts
import next from "next";
// ...
const port = process.env.PORT ? +process.env.PORT : 3000;
const dev = process.env.NODE_ENV !== "production";
const app = next({ dev, customServer: true, hostname: "localhost", port });
```


## Related

<div class="card">
Expand Down