#4655·nitro

vercel: route rules to `config.json` routes mismatch runtime behavior in some cases

Author: pi0xCreated Sep 22, 2026Updated Sep 22, 2026
Labelsbugpreset:vercel

The Vercel preset turns route rules into config.json routes in generateBuildConfig (src/presets/vercel/utils.ts), and a few cases don't match the runtime behavior:

  • A headers rule with redirect: false stops edge routing, so everything more specific under that path is skipped at the edge: public asset cache-control (immutable caching is lost), more specific redirects (served by the function instead), and CDN proxy rewrites (proxied by the function instead). Keeping continue: true and excluding the path from broader redirects with a negative lookahead in their src would fix it.
  • redirect: false without headers is ignored, so "/foo/**": { redirect: "/x" } plus "/foo/keep": { redirect: false } still redirects /foo/keep at the edge.
  • src is built with path.replace("/**", "/(.*)"), so /foo/* and mid-path ** are emitted as-is (literal *) and regex characters in paths are not escaped.
  • /api/** does not match /api at the edge, while the runtime matches it.
  • Route rule sources are not prefixed with baseURL.

Written with AI assistance.