presets: platform route config still diverges from runtime route rules

オープン
#4,707 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@aaronanish-t がすでに取り組んでいます。

2026年11月8日 から。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript
領域
devops

調査の方向性

Start by comparing h3 runtime route behavior with the preset outputs for Netlify, Cloudflare, EdgeOne, and Vercel. Inspect rou3 handling of EdgeOne RE2 patterns, then verify that all listed cases either match runtime behavior or are skipped with a warning where the platform cannot express them.

索引モデルが issue の本文から書いたものです。

説明

preset preset:cloudflare preset:netlify route-rules

Follow-up to #4706. These cases were already broken before that PR. In each one, the redirect and header config that presets generate (Netlify/Cloudflare _redirects and _headers, EdgeOne and Vercel config.json) does something different from the h3 runtime.

  • Named catch-alls in redirect targets. h3 only fills in ** in the target when the rule key ends in a plain /**. For /old/**:path → /new/**, the runtime sends /old/a/b to /new/old/a/b, but the presets emit /new/a/b. Probably better aligned in h3.
  • Patterns Netlify and Cloudflare can't express. :id(\d+), :id?, :x+, {b}?, *.png and /a/**/b are written as-is and produce invalid lines. They should be skipped with a warning.
  • redirect: false. It doesn't stop a broader redirect on Netlify, Cloudflare or EdgeOne; only Vercel handles it.
  • Method-scoped keys. GET /old/** produces a broken line on Netlify and Cloudflare, and a regex that never matches on EdgeOne and Vercel.
  • Self-redirects. h3 skips a redirect when the request is already at the target, but the platforms don't, so /docs/** → /docs/v2/** loops.
  • baseURL on redirect targets. Cloudflare Pages and EdgeOne add the baseURL to relative targets, while the runtime, Vercel and Netlify don't.
  • EdgeOne RE2. A ** followed by an optional group (/**/{b}?) makes rou3 emit lookbehind, which RE2 rejects. catchAllRef also points at the wrong group there.

Reported with AI assistance.

主要言語
TypeScript
スター
11.5k
フォーク
968
平均マージ
4日 9時間
マージ済み PR(30日)
64

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nitrojs/nitro のほかの issue

nitrojs/nitro の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。