presets: platform route config still diverges from runtime route rules

Open
#4,707 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@aaronanish-t is already working on this.

Since Nov 8, 2026.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
devops

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

Dominant language
TypeScript
Stars
11.5k
Forks
968
Avg merge
4d 9h
Merged PRs (30d)
64

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nitrojs/nitro

All issues in nitrojs/nitro

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.