Skip to content

Configuration Reference

Zion is configured via a single TOML file. Default path: ./zion.toml. Override with ZION_CONFIG env var.

All configuration is validated at startup. Invalid config produces actionable error messages and exits immediately.

[server]

KeyTypeDefaultDescription
listen_httpstringrequiredHTTP bind address (e.g. "0.0.0.0:80")
listen_httpsstringrequiredHTTPS bind address (e.g. "0.0.0.0:443")
rate_limit_rpsu320 (disabled)Max requests per IP per window
rate_limit_window_secsu641Rate limit window in seconds
log_formatstring"text""text" or "json" (structured)

[tls]

KeyTypeDefaultDescription
cert_pathstringrequiredPath to PEM certificate chain
key_pathstringrequiredPath to PEM private key
hot_reloadbooltrueWatch cert directory for changes
min_versionstring"1.3"Minimum TLS version ("1.2" or "1.3")
alpnstring[]["h2", "http/1.1"]ALPN protocol negotiation list
sniSniCert[][]Per-domain certificate mappings

[upstream.<name>]

KeyTypeDefaultDescription
urlstringrequiredUpstream URL (e.g. "http://127.0.0.1:8000")
connect_timeout_msu643000TCP connect timeout in milliseconds
keepaliveusize64Max idle keepalive connections
tlsboolfalseUse HTTPS to connect to upstream

Legacy format [upstreams] (flat key-value map of name to URL) is also supported.

[waf_profile.<name>]

KeyTypeDefaultDescription
max_body_mbu6410Maximum request body size in MB
max_depthusize10Maximum JSON nesting depth
max_string_lenusize1048576Maximum JSON string length (bytes)
deny_unknown_content_typesbooltrueReject content types not in allowed list
allowed_content_typesstring[]["application/json", "multipart/form-data"]Permitted content types

[cache_profile.<name>]

KeyTypeDefaultDescription
modestring"memory"Cache mode ("memory" or "none")
max_entriesusize10000Maximum cached entries (0 = unlimited)
ttl_secondsu6431536000Time-to-live in seconds (default: 1 year)

[[route]]

KeyTypeDefaultDescription
pathstringrequiredURL path pattern (radix tree, supports {*rest})
upstreamstringrequiredName of upstream to forward to
modestring"standard"standard, sse_stream, static_cache, websocket
internal_onlyboolfalseRestrict to private/loopback IPs
waf_profilestringnoneName of WAF profile to apply
cache_profilestringnoneName of cache profile to apply
wafboolfalseLegacy: enable WAF with defaults
max_body_mbu6410Legacy: override body limit when waf = true

[cors]

KeyTypeDefaultDescription
allowed_originsstring[][] (disabled)Allowed origins. ["*"] for any.
allowed_headersstring[]["Content-Type", "Authorization", "X-Requested-With"]Additional allowed headers
max_ageu6486400Pre-flight cache duration in seconds

Environment Variables

VariableDescription
ZION_CONFIGConfig file path (default: ./zion.toml)

Released under the MIT License.