rsnext/test/production
Ngô Đức Anh a4b430e6f1
Better IPv6 support for next-server (#53131)
### What?
This PR makes it easier to use Next.js with IPv6 hostnames such as `::1` and `::`.

### How?
It does so by removing rewrites from `localhost` to `127.0.0.1` introduced in #52492. It also fixes the issue where Next.js tries to fetch something like `http://::1:3000` when `--hostname` is `::1` as it is not a valid URL (browsers' `URL` class throws an error when constructed with such hosts). It also fixes `NextURL` so that it doesn't accept `http://::1:3000` but refuse `http://[::1]:3000`. It also changes `next/src/server/lib/setup-server-worker.ts` so that it uses the server's `address` method to retrieve the host instead of our provided `opts.hostname`, ensuring that no matter what `opts.hostname` is we will always get the correct one.

### Note
I've verified that `next dev`, `next start` and `node .next/standalone/server.js` work with IPv6 hostnames (such as `::` and `::1`), IPv4 hostnames (such as `127.0.0.1`, `0.0.0.0`) and `localhost` - and with any of these hostnames fetching to `localhost` also works. Server Actions and middleware have no problems as well.

This also removes `.next/standalone/server.js`'s logging as we now use `start-server`'s logging to avoid duplicates. `start-server`'s logging has also been updated to report the actual hostname.
![image](https://github.com/vercel/next.js/assets/75556609/cefa5f23-ff09-4cef-a055-13eea7c11d89)
![image](https://github.com/vercel/next.js/assets/75556609/619e82ce-45d9-47b7-8644-f4ad083429db)
The above pictures also demonstrate using Server Actions with Next.js after this PR.
![image](https://github.com/vercel/next.js/assets/75556609/3d4166e9-f950-4390-bde9-af2547658148)

Fixes #53171
Fixes #49578
Closes NEXT-1510

Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
2023-08-14 07:23:24 +00:00
..
app-dir Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
app-dir-edge-runtime-with-wasm chore: remove experimental appDir: true from tests (#52291) 2023-07-05 19:17:29 -07:00
app-dir-hide-suppressed-error-during-next-export Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
app-dir-prefetch-non-iso-url Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
build-spinners chore(ci): remove console.log() (#53413) 2023-08-01 01:32:11 +00:00
ci-missing-typescript-deps Add types as a default dependency into tests (#44140) 2022-12-19 19:05:53 +01:00
custom-error-500 Fix handling with custom _error and pages/500 (#40110) 2022-08-30 18:14:12 -05:00
custom-server Revert "Revert "Separate routing code from render servers (#52492)"" (#53029) 2023-07-21 14:02:52 -07:00
dependencies-can-use-env-vars-in-middlewares Remove static analysis of process.env (#50260) 2023-05-24 08:19:02 -07:00
deployment-id-handling Update default moduleResolution in tsconfig.json from node to bundler (#51957) 2023-07-18 15:11:09 +00:00
disable-fallback-polyfills Update flakey polyfills and acceptance tests (#45313) 2023-01-26 10:25:47 -08:00
edge-config-validations Rename allowDynamic to unstable_allowDynamic (#40496) 2022-09-12 15:32:18 -07:00
edge-runtime-is-addressable Upgrade edge-runtime + make EdgeRuntime value overridable with an env var on compilation (#38331) 2022-07-12 15:18:59 +00:00
edge-safe-dynamic-code Skip build-time dynamic code checks for specific polyfills in the Edge runtime (#52009) 2023-07-04 14:18:02 +00:00
emit-decorator-metadata Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
enoent-during-require Ensure ENOENT error is not ignored when loading pages (#37486) 2022-06-06 14:35:26 -04:00
escheck-output Update swc_core to v0.75.23 (#48098) 2023-04-18 08:59:52 +02:00
eslint-plugin-deps Upgrade typescript to 4.8.2 (#39979) 2022-08-29 16:56:02 +00:00
export Refactor next export tests (#45227) 2023-02-02 16:22:54 +00:00
exported-runtimes-value-validation feat: enhance warning messages about unanalyzable config field (#38907) 2022-07-22 19:31:47 +00:00
fallback-export-error Update check for fallback pages during export (#33323) 2022-01-17 14:44:45 +00:00
fatal-render-errror Ensure default _app is used when falling back to default _error (#39467) 2022-08-10 11:36:22 -05:00
generate-middleware-source-maps feat: enables 'edge' as a possible runtime for API routes (#44045) 2022-12-15 10:08:03 +01:00
handle-already-sent-response Route Module Updates (#51433) 2023-06-21 15:30:24 -07:00
ipc-forbidden-headers add "expect" to list of forbidden IPC headers (#53947) 2023-08-12 19:38:38 +00:00
jest fix(next/image): don't call ReactDOM.preload if missing, such as jest (#53443) 2023-08-08 01:04:40 +00:00
middleware-typescript Update default moduleResolution in tsconfig.json from node to bundler (#51957) 2023-07-18 15:11:09 +00:00
next-font Add next/font import (#45891) 2023-02-16 15:33:39 +01:00
pnpm-support Better IPv6 support for next-server (#53131) 2023-08-14 07:23:24 +00:00
postcss-plugin-config-as-string allow to provide postcss plugin options as a string (#35173) 2022-04-08 16:58:50 +00:00
prerender-prefetch Tweak flakey prefetch test handling (#53391) 2023-07-31 16:20:43 +00:00
reading-request-body-in-middleware fix(stream): Allows body larger than 16 KiB with middleware (#41270) 2022-10-17 15:26:16 -07:00
standalone-mode Better IPv6 support for next-server (#53131) 2023-08-14 07:23:24 +00:00
supports-module-resolution-nodenext Stop overriding the user's TS config with defaults during next build (#45670) 2023-02-15 18:11:00 +01:00
typescript-basic Fix next/dynamic types for resolving named export module (#43923) 2022-12-10 17:35:13 +00:00