Server Configuration Reference
Top-level configuration schema for the Elide HTTP server.
This module is the root of an elide serve configuration. It covers
listeners, routing, forward proxying, TLS, the admin API, global
middleware, and observability. Every field has a sane default so a
minimal config only needs to specify what differs from the defaults.
Server block keys
The servers mapping uses the key as the server's identity. The key
determines default listener and domain settings:
- Domain key (contains
., no:): inferslisten :443and
domains { key } with auto-TLS. Examples: "example.com",
"api.example.com".
- Address key (starts with
:or matcheshost:port): infers
listen { key }. Examples: ":8080", "0.0.0.0:3128".
- Label key (anything else): no inference;
listenanddomains
"main", "internal".
Explicit listen or domains declarations always override inference.
Quick examples
Static site with auto-TLS (inferred from domain key):
amends "elide:serve/ElideServer.pkl"
servers {
["example.com"] {
handler = new StaticFiles { root = "./dist"; spaFallback = true }
}
}Reverse proxy:
servers {
["api.example.com"] {
handler = new ReverseProxy { upstreams { "backend:8080" } }
}
}Forward proxy with MITM:
servers {
[":8080"] {
proxy { mitm {}; recording {} }
}
}Mixed — serve files, reverse proxy an API, and forward proxy on one port:
servers {
["app.example.com"] {
routes {
new { match = "/api/**"; handler = new ReverseProxy { upstreams { "backend:9000" } } }
}
handler = new StaticFiles { root = "./dist"; spaFallback = true }
proxy { mitm {}; recording {} }
}
}> This page is auto-generated from the PKL schema. See the Serve Guide for usage examples.
Serve Reference Pages
| Page | Description |
|---|---|
| Handler Reference | Configuration reference for Elide server handlers |
| Middleware Reference | Configuration reference for Elide server middleware |
| TLS Configuration Reference | Configuration reference for TLS and certificate management |
| Listener Reference | Configuration reference for listener addresses and protocols |
| Route Reference | Configuration reference for route matching and dispatch |
| Network Configuration Reference | Configuration reference for network attachments |
| Tailscale Configuration Reference | Configuration reference for Tailscale integration |
| Tunnel Configuration Reference | Configuration reference for WireGuard tunnel bridging |
| DNS Configuration Reference | Configuration reference for DNS resolver settings |
| WebRTC Configuration Reference | Configuration reference for WebRTC listeners |
Proxy Reference Pages
| Page | Description |
|---|---|
| Proxy Configuration Reference | Configuration reference for the Elide forward proxy |
| MITM Configuration Reference | Configuration reference for MITM TLS interception |
| Access Control Reference | Configuration reference for proxy access control |
| Proxy Rules Reference | Configuration reference for proxy interception rules |
| Recording Configuration Reference | Configuration reference for proxy traffic recording |
Type Re-exports
The root module re-exports types from sub-modules for convenience when amendingElideServer.pkl.
| Type | Source |
|---|---|
Listen | Listen.pkl |
Protocol | Listen.pkl |
Route | Route.pkl |
RouteMatch | Route.pkl |
HttpMethod | Route.pkl |
Handler | Handler.pkl |
StaticFiles | Handler.pkl |
ReverseProxy | Handler.pkl |
Redirect | Handler.pkl |
Cgi | Handler.pkl |
Respond | Handler.pkl |
Upstream | Handler.pkl |
ProxyCache | Handler.pkl |
Middleware | Middleware.pkl |
Compress | Middleware.pkl |
RateLimit | Middleware.pkl |
Cors | Middleware.pkl |
Headers | Middleware.pkl |
BasicAuth | Middleware.pkl |
RequestId | Middleware.pkl |
AccessLog | Middleware.pkl |
Rewrite | Middleware.pkl |
BodyLimit | Middleware.pkl |
TailscaleAuth | Middleware.pkl |
ErrorPage | Middleware.pkl |
JwtAuth | Middleware.pkl |
JwtKey | Middleware.pkl |
JwtAlgorithm | Middleware.pkl |
SecurityHeaders | Middleware.pkl |
IpFilter | Middleware.pkl |
ConnectionLimit | Middleware.pkl |
TlsConfig | Tls.pkl |
CertStorage | Tls.pkl |
OnDemandTls | Tls.pkl |
ClientAuth | Tls.pkl |
DnsConfig | Dns.pkl |
TailscaleConfig | Tailscale.pkl |
DiscoConfig | Tailscale.pkl |
DataPlaneConfig | Tailscale.pkl |
DerpConfig | Tailscale.pkl |
TunnelConfig | Tunnel.pkl |
NetworkConfig | Network.pkl |
WireGuardConfig | Network.pkl |
WebRtcListener | Webrtc.pkl |
ContextMode | Webrtc.pkl |
ProxyConfig | Proxy.pkl |
MitmConfig | Mitm.pkl |
AccessControl | Access.pkl |
ProxyRule | ProxyRule.pkl |
ProxyMatch | ProxyRule.pkl |
RecordingConfig | Recording.pkl |
Shared Types
ServerTransport
Transport backend to use for accepting connections.
"auto" selects the best available backend for the current platform.
typealias ServerTransport = "auto" | "io_uring" | "kqueue" | "epoll" | "nio" | "iocp"LogLevel
Severity level for structured log output. Messages below the configured
level are discarded. Ordered most to least verbose:
"trace", "debug", "info", "warn", "error".
typealias LogLevel = "trace" | "debug" | "info" | "warn" | "error"LogFormat
Format for structured log output.
"json"— one JSON object per line (recommended for log pipelines)"text"— compact single-line text"pretty"— human-readable multiline output
typealias LogFormat = "json" | "text" | "pretty"Http3Policy
HTTP/3 (QUIC) enablement policy.
"ifTls"(default): enable HTTP/3 transparently when TLS is configured;
"required": require HTTP/3 — the server refuses to start if TLS is not
"disabled": never enable HTTP/3, even when TLS is available.
typealias Http3Policy = "ifTls" | "required" | "disabled"ListenEntry
Listener entry — either a full Listen object or a string shorthand.
"0.0.0.0:443" — address with default protocols
new Listen { address = "0.0.0.0:443" } — full form
typealias ListenEntry = String | _listen.ListenUpstreamEntry
Upstream entry — either a full Upstream object or a string shorthand.
"backend-1:8080" — address with default weight
new Upstream { address = "backend-1:8080" } — full form
typealias UpstreamEntry = String | _handler.UpstreamHandlerEntry
Handler for the server block — either a full Handler, or a UInt status code shorthand.
new StaticFiles { root = "./dist" } — serve files
new ReverseProxy { upstreams { "back:8080" } } — proxy upstream
404 — fixed status code
typealias HandlerEntry = UInt(isBetween(100, 599)) | _handler.Handler---
Root Properties
These properties are set at the top level of the configuration file.| Field | Type | Default | Description |
|---|---|---|---|
global | GlobalSettings | (empty) | Global settings applied to all server blocks. See GlobalSettings for |
servers | Mapping | null | Server blocks, keyed by domain, address, or label. |
tls | TlsConfig | (empty) | TLS and certificate management configuration applied to all server |
networks | Mapping | null | Named network attachments (Tailscale, WireGuard, or both). |
devMode | Boolean | false | Enable development mode. When true, the server injects a live-reload |
ktls | Boolean | false | Enable kernel TLS (kTLS) offload. When true, the server hands off |
autoHttpsRedirect | Boolean | true | Automatically redirect plain HTTP requests to HTTPS with a 301 |
admin | AdminSettings | (empty) | Admin API for runtime introspection, metrics, and health probes. |
observability | Observability | new Observability {} | Distributed tracing and telemetry (OpenTelemetry / W3C Trace Context). |
logging | LoggingSettings | (empty) | Structured logging configuration (severity, format, access logs). |
global
Global settings applied to all server blocks. See GlobalSettings for
available fields (workers, connection limits, transport, keep-alive, DNS).
servers
Server blocks, keyed by domain, address, or label.
When null, a single implicit server block is used with default
settings. See ServerBlock for per-block options and the module-level
doc comment for key-inference rules.
servers {
["example.com"] {
handler = new StaticFiles { root = "./dist" }
}
[":8080"] {
proxy { mitm {}; recording {} }
}
}tls
TLS and certificate management configuration applied to all server
blocks by default. Individual blocks can override specific fields via
ServerBlock.tls. See TlsConfig for ACME, cert storage, OCSP
stapling, and cipher-suite options.
networks
Named network attachments (Tailscale, WireGuard, or both).
Each entry is an independent tunnel with its own data plane, routing
rules, and identity. The key is a human-readable name used in logs
and metrics. See NetworkConfig for per-attachment options.
networks {
["production"] {
tailscale { direct = true; authKey = env("TS_PROD_KEY") }
tunnel { bridgeInbound = true }
}
["office-vpn"] {
wireguard { configFile = "./wg-office.conf" }
tunnel { bridgeOutbound = true }
}
}devMode
Enable development mode. When true, the server injects a live-reload
SSE endpoint and a companion snippet into HTML responses.
Pages automatically refresh when the server restarts or files change.
Do not enable in production — it adds latency and exposes an unauthenticated SSE endpoint.
ktls
Enable kernel TLS (kTLS) offload. When true, the server hands off
completed TLS sessions to the Linux kernel TLS subsystem, enabling
zero-copy sendfile() and fd migration with TLS context intact.
Falls back silently to userspace TLS if the kernel lacks kTLS support.
Only effective on Linux with CONFIG_TLS enabled; ignored on macOS
and Windows.
autoHttpsRedirect
Automatically redirect plain HTTP requests to HTTPS with a 301
response. Only effective when TLS is configured (either via auto-TLS
or manual certificates). Set to false to serve both HTTP and HTTPS
without redirection.
admin
Admin API for runtime introspection, metrics, and health probes.
Disabled by default. See AdminSettings for listen address and
authentication options.
observability
Distributed tracing and telemetry (OpenTelemetry / W3C Trace Context).
See Observability for service name, sampling rate, and trace
propagation settings.
logging
Structured logging configuration (severity, format, access logs).
See LoggingSettings for available options.
GlobalSettings
Global settings applied to every server block and listener.
These defaults govern resource limits, timeouts, and transport selection for the entire server process. Per-block overrides (where available) take precedence over these values.| Field | Type | Default | Description |
|---|---|---|---|
workers | UInt | 0 | Number of I/O worker threads. 0 (default) auto-selects based on |
maxConnections | UInt | 65536 | Maximum concurrent connections across all listeners. New connections |
shutdownTimeout | Duration | 30.s | Graceful shutdown drain timeout. Active connections are given this long |
serverName | String | "elide" | Value emitted in the Server response header. Set to "" to suppress |
transport | ServerTransport | "auto" | I/O backend for accepting and driving connections. "auto" (default) |
keepalive | Duration | 75.s | HTTP keep-alive timeout. Idle connections with no in-flight request are |
dns | DnsConfig | (empty) | DNS resolver configuration for outbound connections (upstream proxying, |
workers
Number of I/O worker threads. 0 (default) auto-selects based on
available CPU count — typically one worker per core.
Raise this if profiling shows I/O-bound saturation. For CPU-bound workloads (e.g., CGI, heavy middleware), adding workers beyond core count yields diminishing returns.
maxConnections
Maximum concurrent connections across all listeners. New connections
are rejected with 503 Service Unavailable once this limit is reached.
The default (65536) suits most deployments. Lower it for memory- constrained environments or raise it on high-connection-count edge servers.
shutdownTimeout
Graceful shutdown drain timeout. Active connections are given this long to complete in-flight requests before being forcibly closed.
During the drain period the server stops accepting new connections but continues processing existing ones.
serverName
Value emitted in the Server response header. Set to "" to suppress
the header entirely (recommended for security-sensitive deployments).
transport
I/O backend for accepting and driving connections. "auto" (default)
selects the best available backend for the current platform.
Override only when debugging transport-specific behavior.
keepalive
HTTP keep-alive timeout. Idle connections with no in-flight request are
closed after this period. Set to 0.s to disable keep-alive entirely
(each request opens a new connection).
The default (75s) is intentionally longer than most clients' timeout to let the client close first, avoiding TIME_WAIT on the server.
dns
DNS resolver configuration for outbound connections (upstream proxying, auto-TLS ACME challenges, etc.).
Controls nameservers, hosts file usage, caching, and timeouts.
Defaults to system resolv.conf settings.
See DnsConfig for available fields.
---
ServerBlock
A server block — a virtual host, listener group, or forward proxy.
The server key in the servers mapping determines default behavior:
["example.com"] — domain key: auto-TLS, listen :443
[":8080"] — address key: listen on :8080
["my-service"] — label: explicit listen/domains required
A server block can serve content (handler / routes), act as a
forward proxy (proxy), or both simultaneously. When both routing and
proxy are configured, forward proxy requests (absolute-URI / CONNECT)
are handled by the proxy, and normal requests by routes/handler.
Route for per-path dispatch and Handler for the available
handler types.
| Field | Type | Default | Description |
|---|---|---|---|
listen | Listing | (empty) | Addresses this block listens on. Accepts strings or Listen objects. |
domains | Listing | (empty) | Domain names this block responds to. Used for two purposes: |
http3 | Http3Policy | "ifTls" | HTTP/3 (QUIC) enablement policy for this block. See Http3Policy |
handler | HandlerEntry | 404 | Default handler for requests that match no Route. Also serves as |
routes | Listing | (empty) | Ordered list of routes. Evaluated in declaration order; first match |
proxy | _proxy.ProxyConfig? | null | Forward proxy configuration. When set, this server block accepts |
tls | TlsBlockOverride? | null | Per-block TLS overrides. When null (default), the block inherits |
webrtc | Listing | (empty) | WebRTC listeners for this server block. Each entry binds a UDP socket |
middleware | Listing | (empty) | Middleware applied to every request on this server block, before |
listen
Addresses this block listens on. Accepts strings or Listen objects.
When empty, the listener is inferred from the server key:
- Domain key →
:443with auto-TLS - Address key → the key itself (e.g.,
":8080") - Label key →
:8080(HTTP) or:443(if TLS configured)
Explicit entries always override inference.
listen { "0.0.0.0:8080" }
listen { new Listen { address = "[::]:443"; protocols { "h1"; "h2"; "h3" } } }domains
Domain names this block responds to. Used for two purposes:
1. SNI routing — when multiple server blocks share a listener, the TLS Server Name Indication extension selects the block. 2. Auto-TLS — certificates are automatically issued and renewed for every listed domain via ACME (Let's Encrypt by default).
When empty, inferred from the server key if it looks like a domain. Set explicitly for multi-domain or wildcard blocks:
domains { "example.com"; "www.example.com" }http3
HTTP/3 (QUIC) enablement policy for this block. See Http3Policy
for the available options. The default "ifTls" enables HTTP/3
transparently whenever TLS is configured.
handler
Default handler for requests that match no Route. Also serves as
the sole handler in single-handler mode (when routes is empty).
Accepts any Handler subclass or a bare status code integer:
handler = new StaticFiles { root = "./dist" }
handler = new ReverseProxy { upstreams { "backend:8080" } }
handler = 404When routes are also defined, unmatched requests fall through to
this handler. The default (404) returns a plain 404 response.
routes
Ordered list of routes. Evaluated in declaration order; first match
wins. When no route matches, the block-level handler is invoked.
For a single-handler server, leave this empty and set handler
instead. See Route for match syntax and examples.
proxy
Forward proxy configuration. When set, this server block accepts forward proxy requests (absolute-URI and CONNECT) in addition to normal route-matched requests.
Forward proxy requests are identified by their HTTP form:
GET http://example.com/path— absolute-URI (plain HTTP proxy)CONNECT example.com:443— tunnel request (HTTPS proxy)
Normal requests (relative URI) are handled by routes / handler
as usual, allowing a health check, PAC file, or web UI to coexist
with proxy functionality on the same port.
See ProxyConfig for MITM, recording, and access-control options.
proxy { mitm {}; recording {} }tls
Per-block TLS overrides. When null (default), the block inherits
the root-level tls configuration. Set this to supply a block-
specific certificate, minimum TLS version, or mTLS policy.
See TlsBlockOverride for available fields.
webrtc
WebRTC listeners for this server block. Each entry binds a UDP socket for STUN/DTLS/SCTP traffic and dispatches incoming data channel connections to a JS handler.
See WebRtcListener for per-listener options.
webrtc {
new WebRtcListener { port = 3478; handler = "./rtc-handler.js" }
}middleware
Middleware applied to every request on this server block, before
route matching occurs. Route-level middleware (see Route.middleware)
runs after these and wraps only the matched handler.
Middleware is applied in declaration order (first = outermost layer).
See Middleware for available middleware types.
---
TlsBlockOverride
Per-block TLS overrides. Use this to supply a block-specific certificate
or tighten TLS policy for a single server block. Fields left null
inherit from the root-level TlsConfig.
tls field and TlsConfig.
| Field | Type | Default | Description |
|---|---|---|---|
certFile | String? | null | Path to a PEM-encoded certificate file. Setting this disables auto-TLS |
keyFile | String? | null | Path to the PEM-encoded private key file corresponding to certFile. |
minVersion | _tls.TlsVersion? | null | Minimum TLS version accepted on this block's listeners. Overrides |
cipherSuites | _tls.CipherSuitePreset? | null | Cipher-suite preset for this block. Overrides TlsConfig.cipherSuites |
clientAuth | ClientAuth? | null | Mutual TLS (mTLS) client-certificate authentication policy for this |
certFile
Path to a PEM-encoded certificate file. Setting this disables auto-TLS
for this block — the certificate is used as-is with no automatic
renewal. Must be paired with keyFile.
keyFile
Path to the PEM-encoded private key file corresponding to certFile.
Required whenever certFile is set; ignored otherwise.
minVersion
Minimum TLS version accepted on this block's listeners. Overrides
TlsConfig.minVersion. Common values: "1.2", "1.3".
cipherSuites
Cipher-suite preset for this block. Overrides TlsConfig.cipherSuites
when set. See CipherSuitePreset for available presets.
clientAuth
Mutual TLS (mTLS) client-certificate authentication policy for this
block. When set, clients must present a valid certificate signed by a
trusted CA. See ClientAuth for modes (require, request, verify).
---
AccessLogSettings
Controls per-request access log output.
Access logs are emitted once per completed request and include method, path, status, timing, and size information. Nested underLoggingSettings.accessLog.
| Field | Type | Default | Description |
|---|---|---|---|
enabled | Boolean | true | Whether access logging is active. When false, no per-request log |
output | String | "stdout" | Log destination. Accepts "stdout", "stderr", or an absolute file |
fields | Listing | null | Explicit list of field names to include in each log entry. When null |
enabled
Whether access logging is active. When false, no per-request log
lines are emitted regardless of other settings.
output
Log destination. Accepts "stdout", "stderr", or an absolute file
path (e.g., "/var/log/elide/access.log"). File output is appended
and automatically rotated.
fields
Explicit list of field names to include in each log entry. When null
(default), all standard fields are emitted. Set this to reduce log
volume or exclude sensitive fields.
---
LoggingSettings
Structured logging configuration for the server process.
Controls the severity threshold, output format, and access-log behavior for all server log output.| Field | Type | Default | Description |
|---|---|---|---|
level | LogLevel | "info" | Minimum severity level to emit. Messages below this level are |
format | LogFormat | "json" | Output format for log lines. |
accessLog | AccessLogSettings | (empty) | Per-request access log configuration. Set to null to disable |
level
Minimum severity level to emit. Messages below this level are
discarded. Ordered from most to least verbose:
"trace" > "debug" > "info" > "warn" > "error".
format
Output format for log lines.
"json"— structured JSON, one object per line (default;
"text"— compact single-line text"pretty"— human-readable multiline output (useful in dev)
accessLog
Per-request access log configuration. Set to null to disable
access logging entirely. See AccessLogSettings for field-level
options.
---
AdminSettings
Admin API settings for runtime introspection and control.
The admin API exposes endpoints for health checks, metrics, config reload, and runtime diagnostics. It listens on a separate address from the main server to allow firewall-level isolation.| Field | Type | Default | Description |
|---|---|---|---|
enabled | Boolean | false | Whether the admin API is active. When false (default), no admin |
listen | String | "tcp:127.0.0.1:9091" | Listen address for the admin API. Accepts two forms: |
token | String? | null | Bearer token for admin API authentication. When set, all admin |
enabled
Whether the admin API is active. When false (default), no admin
listener is opened and admin endpoints are unreachable.
listen
Listen address for the admin API. Accepts two forms:
"tcp:HOST:PORT" — TCP socket (e.g., "tcp:127.0.0.1:9091")
"unix:/path/to/socket" — Unix domain socket
Bind to 127.0.0.1 (default) to restrict access to the local
machine. Use a Unix socket for environments where TCP is undesirable.
token
Bearer token for admin API authentication. When set, all admin
endpoints require an Authorization: Bearer header.
Kubernetes health-probe endpoints (/healthz, /readyz) are
exempt from authentication.
When null, the admin API is unauthenticated — ensure the listen
address is not publicly reachable.
---
Observability
Distributed tracing and telemetry configuration.
Controls W3C Trace Context propagation and OpenTelemetry trace export. Traces are emitted via OTLP when an exporter endpoint is configured in the environment (OTEL_EXPORTER_OTLP_ENDPOINT).
| Field | Type | Default | Description |
|---|---|---|---|
traceContext | Boolean | true | Enable W3C Trace Context header parsing and propagation. When true |
serviceName | String | "elide" | OpenTelemetry service name reported in trace spans. Change this to |
samplingRate | Float | 1.0 | Trace sampling rate, from 0.0 (sample nothing) to 1.0 (sample |
traceContext
Enable W3C Trace Context header parsing and propagation. When true
(default), incoming traceparent / tracestate headers are parsed
and forwarded to upstreams, and outgoing responses include trace
headers.
serviceName
OpenTelemetry service name reported in trace spans. Change this to distinguish multiple Elide instances in a shared tracing backend.
samplingRate
Trace sampling rate, from 0.0 (sample nothing) to 1.0 (sample
every request). The default (1.0) is appropriate for development
and low-traffic services. For high-traffic production, values between
0.01 and 0.1 are typical.
---