dev: false "reachable from the network" warning when `devServer.host` is a `*.localhost` subdomain
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #1649 @paoValle による — マージされずにクローズ
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- cli, networking
調査の方向性
listenの実装と、警告およびNetwork:のヒントを出すLOOPBACK_HOSTS.has(hostname)を使った2つのチェックを見つけてください。そのチェックを読み、ホストの分類や開発サーバーの出力を対象とする既存のテストを探してください。両方の箇所で.localhostサブドメインをループバックとして扱ってください。ネットワーク警告が出ず、ネットワークURLとしても表示されなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Environment
@nuxt/cli: 4.0.1nuxt: 4.6.2- Node.js: 24.21.0
- OS: macOS
Reproduction
// nuxt.config.ts
export default defineNuxtConfig({
devServer: { host: 'my-app.localhost' },
})
nuxt dev
Describe the bug
The CLI prints:
The dev server is reachable from the network without authentication: anyone who can connect can read the app, build errors and source code.
The server is not reachable from the network. my-app.localhost resolves to loopback only (dns.lookup('my-app.localhost', { all: true }) returns ::1 and 127.0.0.1), so the listener is bound to loopback just like with localhost.
Per RFC 6761 §6.3, localhost and every name under .localhost resolve to loopback. Browsers resolve them that way without DNS and treat them as secure contexts. *.localhost names are a common way to run several local apps side by side.
Cause
In listen the warning only checks an exact-match set:
const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '::1'])
// ...
if (announce && (anyHost || !LOOPBACK_HOSTS.has(hostname))) logger.warn('The dev server is reachable from the network ...')
my-app.localhost is not in the set, so it is treated as a public host. The same check also drives the Network: hint shown under the URLs.
Suggested fix
Treat any .localhost name as loopback, e.g.:
const isLoopbackHost = host => LOOPBACK_HOSTS.has(host) || host.endsWith('.localhost')
and use it in both places that currently call LOOPBACK_HOSTS.has(hostname).
Workaround
Leave devServer.host unset and pass --publicURL http://my-app.localhost:3000 to nuxt dev, so the CLI shows that URL without the warning.
- 主要言語
- TypeScript
- スター
- 402
- フォーク
- 125
- 平均マージ
- 2日 9時間
- マージ済み PR(30日)
- 37
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nuxt/cli のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
[Bug]: Search input loses focus while typing on the Inventory, Reservations and Locations lists (view_configurations enabled)対応中かも @medusa-os-bot が今日担当しました。 オープンstatus: needs triaging type: bug version: 2.0
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
medusajs/medusa#17886 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
marimo-team/marimo#11949 ·
メンテナーはふだん 1 日以内に返信
-
bug server-time v2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelcontextprotocol/servers#5559 ·
メンテナーはふだん 1 日以内に返信
-
D1 Time Travel restore help advertises 30 days without a plan qualifier対応中かも @akhil9tiet が今日担当しました。 オープンbug package:wrangler product:d1
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
cloudflare/workers-sdk#17000 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
bug severity:medium triage:confirmed triage:reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Cotal-AI/Cotal#7440 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信