Render Configuration
The [render] section controls how PRISM renders pages using a headless Chromium browser. It includes sub-sections for the browser tab pool, circuit breaker, HTML postprocessing, viewport emulation, and content validation.
TOML Example
[render]
wait_for = "load"
timeout_secs = 10
block_resources = ["font", "image", "media", "stylesheet"]
status_from_meta = false
fail_on_console_errors = false
min_html_size = 512
post_wait_js = "document.querySelector('.lazy')?.classList.remove('hidden')"
[render.pool]
tabs = 8
max_renders_per_tab = 50
queue_max = 100
[render.circuit_breaker]
failure_threshold = 5
recovery_timeout_secs = 30
half_open_max_requests = 1
[render.postprocess]
enabled = true
strip_scripts = true
strip_noscript = true
strip_comments = true
strip_event_handlers = true
strip_hydration_attrs = true
resolve_lazy_images = true
[render.viewport]
enabled = false
mobile_width = 412
mobile_height = 915
desktop_width = 1920
desktop_height = 1080
[render.content_validation]
enabled = true
min_text_length = 100
require_title = true
min_html_bytes = 1024
Top-Level Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
wait_for | String | "load" | Page readiness signal: load, domcontentloaded, networkidle, or selector:<CSS> |
timeout_secs | Integer | 10 | Maximum seconds to wait for a page render. Must be > 0 |
block_resources | Array of Strings | ["font", "image", "media", "stylesheet"] | Resource types to block during rendering |
status_from_meta | Boolean | false | Extract HTTP status from <meta name="render:status_code"> or <meta name="prism:status"> |
fail_on_console_errors | Boolean | false | Fall back to origin if JS console errors detected and HTML is below min_html_size |
min_html_size | Integer | 512 | Minimum rendered HTML bytes; below this with console errors triggers fallback |
post_wait_js | String or null | null | JavaScript to execute after wait_for completes but before HTML extraction |
wait_for
Controls when PRISM considers the page "ready" to extract HTML:
load(default): Waits for theloadevent. Good for most SPAs.domcontentloaded: Fires earlier, before images/stylesheets finish loading. Faster but may miss lazy content.networkidle: Waits until there are no more than 2 network connections for 500ms. Most thorough but slowest.selector:<CSS>: Waits until a specific CSS selector appears in the DOM. Example:selector:#app-loadedorselector:.content-ready.
status_from_meta
When enabled, PRISM scans rendered HTML for meta tags like:
<meta name="render:status_code" content="404">
<meta name="prism:status" content="404">
This lets SPAs that render 404 pages client-side communicate the correct HTTP status code to crawlers.
post_wait_js
Optional JavaScript executed after the wait_for condition is met but before HTML is extracted. Useful for DOM fixups on SPAs with lazy hydration, such as removing hidden classes that a framework has not yet removed.
Pool Configuration
The [render.pool] sub-section controls the Chromium browser tab pool.
| Parameter | Type | Default | Description |
|---|---|---|---|
tabs | Integer | 8 | Number of browser tabs to keep open. Must be > 0 |
max_renders_per_tab | Integer | 50 | Renders before recycling a tab (prevents memory leaks) |
queue_max | Integer | 100 | Maximum queued render requests before rejecting new ones |
Increasing tabs improves concurrent throughput but uses more memory. Each tab consumes roughly 50-100 MB of RAM depending on page complexity.
Circuit Breaker Configuration
The [render.circuit_breaker] sub-section implements the circuit breaker pattern to protect against cascading failures when Chromium is unhealthy.
| Parameter | Type | Default | Description |
|---|---|---|---|
failure_threshold | Integer | 5 | Consecutive failures before opening the circuit |
recovery_timeout_secs | Integer | 30 | Seconds to wait before attempting recovery (half-open state) |
half_open_max_requests | Integer | 1 | Number of test requests allowed in half-open state |
When the circuit is open, all render requests immediately fall back to the origin response instead of waiting for Chromium.
Postprocess Configuration
The [render.postprocess] sub-section controls HTML cleanup applied to rendered output before caching and serving.
| Parameter | Type | Default | Description |
|---|---|---|---|
enabled | Boolean | true | Enable or disable all postprocessing |
strip_scripts | Boolean | true | Remove <script> tags from rendered HTML |
strip_noscript | Boolean | true | Remove <noscript> tags |
strip_comments | Boolean | true | Remove HTML comments |
strip_event_handlers | Boolean | true | Remove inline event handlers (onclick, onload, etc.) |
strip_hydration_attrs | Boolean | true | Remove framework hydration attributes (data-reactid, ng-*, etc.) |
resolve_lazy_images | Boolean | true | Move data-src to src for lazy-loaded images |
Postprocessing produces cleaner HTML for search engine crawlers and reduces response size.
Viewport Configuration
The [render.viewport] sub-section enables viewport emulation for mobile-aware rendering.
| Parameter | Type | Default | Description |
|---|---|---|---|
enabled | Boolean | false | Enable viewport-aware rendering |
mobile_width | Integer | 412 | Width in pixels for mobile viewport |
mobile_height | Integer | 915 | Height in pixels for mobile viewport |
desktop_width | Integer | 1920 | Width in pixels for desktop viewport |
desktop_height | Integer | 1080 | Height in pixels for desktop viewport |
When enabled, PRISM detects the requesting device type and sets the browser viewport accordingly. This ensures responsive SPAs render the correct layout for mobile vs. desktop crawlers (e.g., Googlebot Mobile).
Content Validation Configuration
The [render.content_validation] sub-section validates rendered output quality before caching and serving.
| Parameter | Type | Default | Description |
|---|---|---|---|
enabled | Boolean | true | Enable content validation |
min_text_length | Integer | 100 | Minimum visible text characters (after stripping HTML tags) |
require_title | Boolean | true | Require a non-empty <title> tag in rendered output |
min_html_bytes | Integer | 1024 | Minimum total HTML size in bytes |
Content validation catches broken renders (empty pages, error screens) and prevents them from being cached or served to crawlers.
Example Use Cases
React SPA with slow hydration
[render]
wait_for = "selector:#app-ready"
timeout_secs = 15
post_wait_js = "document.querySelectorAll('.skeleton').forEach(el => el.remove())"
[render.pool]
tabs = 12
queue_max = 200
High-traffic site with conservative settings
[render]
wait_for = "load"
timeout_secs = 8
fail_on_console_errors = true
min_html_size = 1024
[render.circuit_breaker]
failure_threshold = 3
recovery_timeout_secs = 60
[render.content_validation]
enabled = true
min_text_length = 200
min_html_bytes = 2048
Minimal postprocessing for debugging
[render.postprocess]
enabled = true
strip_scripts = false
strip_comments = false
strip_hydration_attrs = false