Skip to main content

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

ParameterTypeDefaultDescription
includeArray of Strings["/**"]Glob patterns for paths eligible for rendering
excludeArray of Strings(see above)Glob patterns for paths to skip rendering

Glob Matching

PRISM uses standard glob syntax for route patterns:

PatternMatches
/**All paths
/blog/**/blog/post-1, /blog/2024/my-post, etc.
**/*.jsAny path ending in .js at any depth
/api/**/api/users, /api/v2/products, etc.
/exact-pathOnly /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:

  1. Check if the path matches any include pattern
  2. Check if the path matches any exclude pattern
  3. If both match, the path is excluded
  4. If only include matches, the path is rendered
  5. 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",
]