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 :): infers listen :443 and
domains { key } with auto-TLS. Examples: "example.com", "api.example.com".
  • Address key (starts with : or matches host:port): infers
listen { key }. Examples: ":8080", "0.0.0.0:3128".
  • Label key (anything else): no inference; listen and domains
must be set explicitly. Examples: "main", "internal".

Explicit listen or domains declarations always override inference.

Quick examples

Static site with auto-TLS (inferred from domain key):

pkl
amends "elide:serve/ElideServer.pkl"
servers {
  ["example.com"] {
    handler = new StaticFiles { root = "./dist"; spaFallback = true }
  }
}

Reverse proxy:

pkl
servers {
  ["api.example.com"] {
    handler = new ReverseProxy { upstreams { "backend:8080" } }
  }
}

Forward proxy with MITM:

pkl
servers {
  [":8080"] {
    proxy { mitm {}; recording {} }
  }
}

Mixed — serve files, reverse proxy an API, and forward proxy on one port:

pkl
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

PageDescription
Handler ReferenceConfiguration reference for Elide server handlers
Middleware ReferenceConfiguration reference for Elide server middleware
TLS Configuration ReferenceConfiguration reference for TLS and certificate management
Listener ReferenceConfiguration reference for listener addresses and protocols
Route ReferenceConfiguration reference for route matching and dispatch
Network Configuration ReferenceConfiguration reference for network attachments
Tailscale Configuration ReferenceConfiguration reference for Tailscale integration
Tunnel Configuration ReferenceConfiguration reference for WireGuard tunnel bridging
DNS Configuration ReferenceConfiguration reference for DNS resolver settings
WebRTC Configuration ReferenceConfiguration reference for WebRTC listeners

Proxy Reference Pages

PageDescription
Proxy Configuration ReferenceConfiguration reference for the Elide forward proxy
MITM Configuration ReferenceConfiguration reference for MITM TLS interception
Access Control ReferenceConfiguration reference for proxy access control
Proxy Rules ReferenceConfiguration reference for proxy interception rules
Recording Configuration ReferenceConfiguration reference for proxy traffic recording

Type Re-exports

The root module re-exports types from sub-modules for convenience when amending ElideServer.pkl.
TypeSource
ListenListen.pkl
ProtocolListen.pkl
RouteRoute.pkl
RouteMatchRoute.pkl
HttpMethodRoute.pkl
HandlerHandler.pkl
StaticFilesHandler.pkl
ReverseProxyHandler.pkl
RedirectHandler.pkl
CgiHandler.pkl
RespondHandler.pkl
UpstreamHandler.pkl
ProxyCacheHandler.pkl
MiddlewareMiddleware.pkl
CompressMiddleware.pkl
RateLimitMiddleware.pkl
CorsMiddleware.pkl
HeadersMiddleware.pkl
BasicAuthMiddleware.pkl
RequestIdMiddleware.pkl
AccessLogMiddleware.pkl
RewriteMiddleware.pkl
BodyLimitMiddleware.pkl
TailscaleAuthMiddleware.pkl
ErrorPageMiddleware.pkl
JwtAuthMiddleware.pkl
JwtKeyMiddleware.pkl
JwtAlgorithmMiddleware.pkl
SecurityHeadersMiddleware.pkl
IpFilterMiddleware.pkl
ConnectionLimitMiddleware.pkl
TlsConfigTls.pkl
CertStorageTls.pkl
OnDemandTlsTls.pkl
ClientAuthTls.pkl
DnsConfigDns.pkl
TailscaleConfigTailscale.pkl
DiscoConfigTailscale.pkl
DataPlaneConfigTailscale.pkl
DerpConfigTailscale.pkl
TunnelConfigTunnel.pkl
NetworkConfigNetwork.pkl
WireGuardConfigNetwork.pkl
WebRtcListenerWebrtc.pkl
ContextModeWebrtc.pkl
ProxyConfigProxy.pkl
MitmConfigMitm.pkl
AccessControlAccess.pkl
ProxyRuleProxyRule.pkl
ProxyMatchProxyRule.pkl
RecordingConfigRecording.pkl

Shared Types

ServerTransport

Transport backend to use for accepting connections.

"auto" selects the best available backend for the current platform.
pkl
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".

pkl
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
pkl
typealias LogFormat = "json" | "text" | "pretty"

Http3Policy

HTTP/3 (QUIC) enablement policy.

  • "ifTls" (default): enable HTTP/3 transparently when TLS is configured;
disable silently otherwise.
  • "required": require HTTP/3 — the server refuses to start if TLS is not
configured.
  • "disabled": never enable HTTP/3, even when TLS is available.
pkl
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
pkl
typealias ListenEntry = String | _listen.Listen

UpstreamEntry

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
pkl
typealias UpstreamEntry = String | _handler.Upstream

HandlerEntry

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
pkl
typealias HandlerEntry = UInt(isBetween(100, 599)) | _handler.Handler

---

Root Properties

These properties are set at the top level of the configuration file.
FieldTypeDefaultDescription
globalGlobalSettings(empty)Global settings applied to all server blocks. See GlobalSettings for
serversMapping?nullServer blocks, keyed by domain, address, or label.
tlsTlsConfig(empty)TLS and certificate management configuration applied to all server
networksMapping?nullNamed network attachments (Tailscale, WireGuard, or both).
devModeBooleanfalseEnable development mode. When true, the server injects a live-reload
ktlsBooleanfalseEnable kernel TLS (kTLS) offload. When true, the server hands off
autoHttpsRedirectBooleantrueAutomatically redirect plain HTTP requests to HTTPS with a 301
adminAdminSettings(empty)Admin API for runtime introspection, metrics, and health probes.
observabilityObservabilitynew Observability {}Distributed tracing and telemetry (OpenTelemetry / W3C Trace Context).
loggingLoggingSettings(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.

pkl
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.

pkl
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