presets: platform route config still diverges from runtime route rules

Aperta
#4,707 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@aaronanish-t ci sta già lavorando.

Dal 8/11/2026.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
devops

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
11.5k
Fork
968
Merge medio
4g 9h
PR unite (30g)
64

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nitrojs/nitro

Tutte le issue di nitrojs/nitro

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.