Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/vinext/llms.txt
Use this file to discover all available pages before exploring further.
Route Segment Config
Route segment config options allow you to configure the behavior of a Page, Layout, or Route Handler by exporting constants.Usage
Export configuration constants frompage.tsx, layout.tsx, or route.ts:
Options
dynamic
Type:'auto' | 'force-dynamic' | 'force-static' | 'error'Default:
'auto'
Control static/dynamic rendering behavior.
Values
'auto' (default)Automatic detection. Use static rendering unless dynamic APIs are called.
'force-dynamic'Force dynamic rendering. Page is always server-rendered on each request. Sets
Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate header.
'force-static'Force static rendering. Page is rendered once at build time. Sets
Cache-Control: public, max-age=31536000, immutable header.
'error'Throw error if dynamic APIs are used. Useful to ensure pages remain fully static.
revalidate
Type:number | falseDefault:
false
Time in seconds until the page is revalidated (ISR).
Values
false (default)No revalidation. Cached indefinitely (or until manually invalidated).
0No caching. Equivalent to
dynamic = 'force-dynamic'.
numberRevalidate after N seconds. Uses stale-while-revalidate strategy:
- Cached responses served instantly
- Background revalidation triggered after expiry
- New version served on next request after revalidation completes
Route Handlers
Route handlers supportrevalidate for ISR:
Cache-Control: s-maxage=60, stale-while-revalidate header.
dynamicParams
Type:booleanDefault:
true
Control behavior for dynamic routes not generated by generateStaticParams.
Values
true (default)Dynamic segments not in
generateStaticParams are generated on-demand.
falseDynamic segments not in
generateStaticParams return 404.
runtime
Next.js uses this to switch between Node.js and Edge runtimes. vinext deploys everything to the same environment.preferredRegion
Next.js uses this for Vercel’s regional deployments. On Cloudflare Workers, all code runs on the edge globally.Combining Options
You can export multiple segment config options:ISR with Cache Handler
For production ISR, set a cache handler:Cache-Control Headers
Route segment config automatically sets appropriateCache-Control headers:
| Config | Cache-Control |
|---|---|
dynamic: 'force-dynamic' | private, no-cache, no-store, max-age=0, must-revalidate |
dynamic: 'force-static' | public, max-age=31536000, immutable |
revalidate: 60 | s-maxage=60, stale-while-revalidate |
revalidate: false | No cache header (default) |
Type Safety
Import types for route segment config:Related
- KV Cache Handler - Cloudflare KV cache backend
- revalidateTag/revalidatePath - Manual cache invalidation
- generateStaticParams - Static path generation