Routes Configuration
The [routes] section defines which URL paths PRISM should render and which it should skip (proxy directly to origin).
TOML Example
[routes]
include = ["/**"]
exclude = [
"/api/**",
"/graphql",
"**/*.js",
"**/*.css",
"**/*.json",
"**/*.xml",
"**/*.png",
"**/*.jpg",
"**/*.gif",
"**/*.svg",
"**/*.ico",
"**/*.woff",
"**/*.woff2",
"**/*.ttf",
"**/*.wasm",
"**/*.map",
"/_next/**",
"/static/**",
"/admin/**",
]
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
include | Array of Strings | ["/**"] | Glob patterns for paths eligible for rendering |
exclude | Array of Strings | (see above) | Glob patterns for paths to skip rendering |
Glob Matching
PRISM uses standard glob syntax for route patterns:
| Pattern | Matches |
|---|---|
/** | All paths |
/blog/** | /blog/post-1, /blog/2024/my-post, etc. |
**/*.js | Any path ending in .js at any depth |
/api/** | /api/users, /api/v2/products, etc. |
/exact-path | Only /exact-path (no wildcards) |
Precedence
Exclude takes precedence over include. If a path matches both an include and an exclude pattern, it is excluded from rendering and proxied directly to the origin.
The evaluation logic is:
- Check if the path matches any
includepattern - Check if the path matches any
excludepattern - If both match, the path is excluded
- If only include matches, the path is rendered
- If neither matches, the path is proxied (not rendered)
Detailed Explanation
Default exclude list
The default exclude list covers common static assets, API endpoints, and framework-specific paths that never need rendering:
- API routes:
/api/**,/graphql-- backend endpoints return JSON, not HTML - Static assets:
**/*.js,**/*.css,**/*.json,**/*.xml-- not HTML pages - Images:
**/*.png,**/*.jpg,**/*.gif,**/*.svg,**/*.ico - Fonts:
**/*.woff,**/*.woff2,**/*.ttf - Other:
**/*.wasm,**/*.map-- WebAssembly and source maps - Framework paths:
/_next/**(Next.js internals),/static/**,/admin/**
Custom include patterns
The default ["/**"] includes all paths. Narrow this to only render specific sections:
[routes]
include = ["/blog/**", "/products/**", "/"]
exclude = []
Example Use Cases
Only render marketing pages
[routes]
include = ["/", "/features", "/pricing", "/blog/**", "/about"]
exclude = []
Render everything except admin and API
[routes]
include = ["/**"]
exclude = ["/api/**", "/graphql", "/admin/**", "/dashboard/**"]
Next.js application
[routes]
include = ["/**"]
exclude = [
"/api/**",
"/_next/**",
"/static/**",
"**/*.js",
"**/*.css",
"**/*.json",
"**/*.png",
"**/*.jpg",
"**/*.svg",
"**/*.ico",
"**/*.woff2",
]