Server Configuration
The [server] section controls how PRISM listens for incoming requests, connects to your origin application, and manages connections.
TOML Example
[server]
address = "127.0.0.1:4000"
origin = "http://localhost:3000"
mode = "bot-only"
shadow = false
drain_timeout_secs = 30
proxy_timeout_secs = 30
trusted_proxies = ["10.0.0.0/8", "172.16.0.0/12"]
max_connections = 10000
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
address | String | "127.0.0.1:4000" | Socket address PRISM listens on |
origin | String | "http://localhost:3000" | URL of your application server |
mode | String | "bot-only" | Render mode: bot-only or render-all |
shadow | Boolean | false | Shadow mode: render in background, serve origin response |
drain_timeout_secs | Integer | 30 | Seconds to wait for in-flight renders during graceful shutdown |
proxy_timeout_secs | Integer | 30 | Timeout in seconds for proxy requests to the origin |
trusted_proxies | Array of Strings | [] | IP addresses/CIDRs to trust for X-Forwarded-Proto. Empty = trust all |
max_connections | Integer | 10000 | Maximum concurrent connections. 0 = unlimited |
Detailed Explanation
address
The IP and port PRISM binds to. Use 0.0.0.0:4000 to listen on all interfaces, or 127.0.0.1:4000 to restrict to localhost only.
origin
The URL of your upstream application. All requests that do not require rendering (or all requests in proxy-only mode) are forwarded here. PRISM validates that this does not point to its own listen address to prevent infinite render loops.
mode
bot-only(default): Only render pages for detected bot user agents. Human visitors are proxied directly to the origin.render-all: Render every matching request through the headless browser, regardless of user agent. Useful for fully static SEO output.
shadow
When enabled, PRISM renders pages in the background but always serves the origin response to the client. It logs comparison statistics (origin bytes vs. rendered bytes) for validation purposes. This is useful for testing PRISM in production without affecting real traffic.
drain_timeout_secs
During graceful shutdown (e.g., SIGTERM), PRISM waits up to this many seconds for in-flight render operations to complete before forcefully terminating.
proxy_timeout_secs
Maximum time to wait for a response from the origin server when proxying requests. If the origin does not respond within this window, PRISM returns a gateway timeout error.
trusted_proxies
When set, PRISM only accepts X-Forwarded-Proto and similar headers from these IP addresses. This prevents clients from spoofing protocol headers. When empty (default), all sources are trusted for backwards compatibility.
max_connections
Limits the number of simultaneous connections PRISM accepts. Once the limit is reached, new connections are rejected. Set to 0 to disable the limit.
Example Use Cases
Production behind a load balancer
[server]
address = "0.0.0.0:4000"
origin = "http://app-service:3000"
mode = "bot-only"
trusted_proxies = ["10.0.0.0/8"]
max_connections = 5000
Testing with shadow mode
[server]
address = "127.0.0.1:4000"
origin = "http://localhost:3000"
mode = "bot-only"
shadow = true
Full pre-rendering for all visitors
[server]
address = "0.0.0.0:4000"
origin = "http://localhost:3000"
mode = "render-all"
proxy_timeout_secs = 15