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
headersrule withredirect: falsestops edge routing, so everything more specific under that path is skipped at the edge: public assetcache-control(immutable caching is lost), more specific redirects (served by the function instead), and CDN proxy rewrites (proxied by the function instead). Keepingcontinue: trueand excluding the path from broader redirects with a negative lookahead in theirsrcwould fix it. redirect: falsewithoutheadersis ignored, so"/foo/**": { redirect: "/x" }plus"/foo/keep": { redirect: false }still redirects/foo/keepat the edge.srcis built withpath.replace("/**", "/(.*)"), so/foo/*and mid-path**are emitted as-is (literal*) and regex characters in paths are not escaped./api/**does not match/apiat the edge, while the runtime matches it.- Route rule sources are not prefixed with
baseURL.
Written with AI assistance.
Source: nitrojs/nitro