[Bug]: [MCP/CLI] Bare loopback IP addresses (127.0.0.1:port) and hosts with ports fail to navigate due to erroneous scheme inference
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- cli
調査の方向性
スキーム推論は packages/playwright-core/src/tools/backend/tab.ts の checkUrlAndNavigate にあります。まずこの関数を読み、次に catch ブロックが http:// と https:// のどちらを選ぶかを確認してください。また、new URL('example.com:8080') は例外を投げない点にも注意してください。完了の条件は、127.0.0.1:3000、0.0.0.0:8000、[::1]:8080 がデフォルトで http:// になり、example.com:8080 がデフォルトで https:// になり、既存の明示的なスキームがそのまま残ることです。動作を確認するため、タブのナビゲーションを扱う既存のテストを探してください。
索引モデルが issue の本文から書いたものです。
説明
What's going on?
In Playwright CLI and MCP server (playwright open, tab-new, browser_navigate), when opening or navigating to URLs specified without an explicit scheme:
-
Bare loopback IP addresses fail with
net::ERR_SSL_PROTOCOL_ERROR:
When targeting local development servers on loopback IPs (e.g.,127.0.0.1:3000,0.0.0.0:8000,[::1]:8080), navigation fails immediately:page.goto: net::ERR_SSL_PROTOCOL_ERROR at https://127.0.0.1:3000/This happens because
checkUrlAndNavigateonly checksurl.startsWith('localhost')before defaulting tohttps://. As local development servers predominantly run on plain HTTP, forcinghttps://causes SSL protocol failure. -
Bare hostnames with ports fail with
net::ERR_ABORTED:
When specifying a bare host with a port (e.g.,example.com:8080), navigation fails:page.goto: net::ERR_ABORTED at example.com:8080According to the WHATWG URL standard,
new URL('example.com:8080')parses successfully withprotocol: "example.com:"andpathname: "8080". Becausenew URL(...)does not throw an error, thetry / catchblock incheckUrlAndNavigateis bypassed entirely, leaving the raw string without anhttp://orhttps://scheme.
Visual Evidence
1. Reproduction — SSL Protocol Error on Loopback IP & Aborted Custom Scheme:

2. Fixed Behavior — Loopback IPs and Ported Hosts Normalized Properly:

Why does this happen?
In packages/playwright-core/src/tools/backend/tab.ts:
async checkUrlAndNavigate(url: string): Promise<string> {
try {
new URL(url);
} catch (e) {
if (url.startsWith('localhost'))
url = 'http://' + url;
else
url = 'https://' + url;
}
this.context.checkUrlAllowed(url);
await this.navigate(url);
return url;
}
- WHATWG
new URL()does not throw onhost:portbecausehost:is treated as a valid scheme name ifhostbegins with an ASCII alpha character ([a-zA-Z]). - Loopback IPs begin with numbers (
127.0.0.1) sonew URL()throws, but the catch branch only checkslocalhost, falling through tohttps://for all IPv4/IPv6 loopback addresses.
Expected behavior
- URLs without an explicit scheme (
^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/or^(about|data|blob|javascript):) should be normalized. - Local loopback addresses (
localhost,127.0.0.1,0.0.0.0,[::1]) should default tohttp://. - Other bare hosts (e.g.
example.com:8080,playwright.dev) should default tohttps://.
- 主要言語
- TypeScript
- スター
- 99.1k
- フォーク
- 6.8k
- 平均マージ
- 15時間 58分
- マージ済み PR(30日)
- 302
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/playwright のほかの issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/playwright#43741 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
microsoft/playwright#43834 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: `Update snapshot` sticky header in UI Mode Attachments panel対応中かも @microsoft-playwright-automation が 1 日前に担当しました。 オープンneeds-triage
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
microsoft/playwright#43833 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: --only-changed misses a test file when two ESM test files share an import対応中かも @cpeaustriajc が 2 日前に担当しました。 オープンneeds-triage
難易度 3/5 1〜2日 初心者へのやさしさ 15/100
microsoft/playwright#43824 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[Feature]: Let an MCP client label its own extension tab group対応中かも @microsoft-playwright-automation が 2 日前に担当しました。 オープンneeds-triage
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
microsoft/playwright#43823 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
microsoft/playwright の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
remotion-dev/remotion#12905 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
supermomonga/paseo-plugin-zcode-provider#83 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
oxidecomputer/skepsis#102 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
voidzero-dev/void#677 ·
メンテナーはふだん 1 日以内に返信