TLS Configuration Reference

TLS and certificate management configuration for the Elide HTTP server.

Provides three modes of certificate provisioning:

1. Automatic ACME (auto = true, the default) — obtains and renews certificates automatically for every domain listed in ServerBlock.domains, using Let's Encrypt or a fallback CA. 2. Manual (certFile + keyFile) — uses static PEM certificate and key files that you provision and rotate yourself. 3. On-demand (onDemand) — issues certificates at TLS-handshake time for hostnames not known in advance. See OnDemandTls.

These modes can be combined: auto covers declared domains while onDemand handles dynamic hostnames.

See DnsChallenge for wildcard certificate support via DNS-01 and ClientAuth for mutual TLS (mTLS) client verification.

> This page is auto-generated from the PKL schema. See the guide for usage examples.

Types

TlsVersion

Minimum TLS protocol version accepted by listeners.

"1.3" — TLS 1.3 only. Strongest security; recommended for public-facing servers. "1.2" — TLS 1.2 and above. Broader client compatibility.
pkl
typealias TlsVersion = "1.2" | "1.3"

CipherSuitePreset

Named TLS cipher suite group applied during negotiation.

"default" — Elide's recommended set of safe, modern ciphers. "fips" — restricts to FIPS 140-2 approved suites only. "legacy" — adds older cipher suites for maximum client compatibility. Not recommended for public-facing servers.
pkl
typealias CipherSuitePreset = "default" | "fips" | "legacy"

---

OnDemandTls

On-demand TLS issues a certificate at TLS-handshake time for hostnames that have not been pre-provisioned.

This avoids the need to enumerate all domains in config ahead of time, which is useful for multi-tenant platforms and wildcard-like setups. An authorization endpoint (ask) is strongly recommended to prevent abuse by arbitrary clients triggering certificate issuance.

Rate limiting via maxPerWindow and burst protects against certificate-flooding attacks.
FieldTypeDefaultDescription
askUri?nullAuthorization URL queried before issuing a certificate.
maxPerWindowUInt?nullMaximum number of certificates that may be issued per window.
burstUInt5Burst allowance above maxPerWindow during short traffic spikes.
windowDuration1.hSliding window duration for the maxPerWindow rate limit.

ask

Authorization URL queried before issuing a certificate.

The server sends a GET request with a domain query parameter containing the requested hostname. A 200 OK response permits issuance; any other status code denies it. When null, all hostnames are permitted (use with caution).

maxPerWindow

Maximum number of certificates that may be issued per window.

When null, no rate limit is applied (not recommended in production).

burst

Burst allowance above maxPerWindow during short traffic spikes.

The effective limit becomes maxPerWindow + burst until the sliding window catches up. Default: 5.

window

Sliding window duration for the maxPerWindow rate limit.

Default: 1 hour.

---

DnsChallenge

DNS-01 ACME challenge configuration.

DNS-01 challenges prove domain ownership by creating a DNS TXT record. This is the only ACME challenge type that supports wildcard certificates (e.g., *.example.com). Use this when HTTP-01 challenges are not feasible (e.g., the server is not publicly reachable on port 80).

Requires auto = true on TlsConfig.
FieldTypeDefaultDescription
provider"cloudflare"\"webhook"(required)DNS challenge provider that creates and cleans up TXT records.
configMappingnew Mapping {}Provider-specific key/value overrides.
propagationTimeoutDuration120.sMaximum time to wait for DNS TXT record propagation before the
pollIntervalDuration5.sHow frequently to poll the DNS provider to check whether the TXT

provider

DNS challenge provider that creates and cleans up TXT records.

"cloudflare" — uses the Cloudflare API. Requires the CLOUDFLARE_API_TOKEN environment variable. Optionally set CLOUDFLARE_ZONE_ID to scope to a specific zone. "webhook" — POSTs challenge records to a custom URL. Requires the DNS_WEBHOOK_URL or DNS_WEBHOOK_SCRIPT environment variable.

config

Provider-specific key/value overrides.

Most providers read credentials from environment variables, so this mapping is typically empty. Use it for overrides such as a custom API endpoint, zone ID, or webhook secret.

propagationTimeout

Maximum time to wait for DNS TXT record propagation before the challenge is considered failed.

Default: 120 seconds.

pollInterval

How frequently to poll the DNS provider to check whether the TXT record has propagated.

Default: 5 seconds.

---

CertStorage

Persistent storage backend for certificates, OCSP staples, and ACME account keys.

Certificates and ACME state are written to disk so they survive server restarts. Ensure the directory is backed up and has appropriate filesystem permissions (contains private keys).
FieldTypeDefaultDescription
pathString"~/.local/share/elide/certs"Directory path for file-based certificate storage.

path

Directory path for file-based certificate storage.

The directory is created automatically if it does not exist. Platform defaults:
pkl
Linux/macOS: `~/.local/share/elide/certs`
Windows:     `%LOCALAPPDATA%\Elide\certs`

---

ClientAuth

Mutual TLS (mTLS) client-certificate authentication settings.

Configures the server to request (and optionally require) a client certificate during the TLS handshake. The certificate is verified against the trusted CA chain specified in trustedCAs.
FieldTypeDefaultDescription
trustedCAsListing(!isEmpty)(required)Paths to PEM-encoded CA certificate files trusted for client
requiredBooleantrueWhether a valid client certificate is mandatory.

trustedCAs

Paths to PEM-encoded CA certificate files trusted for client certificate verification.

At least one CA file is required. Intermediate CAs should be included if clients present certificate chains.

required

Whether a valid client certificate is mandatory.

When true (default), connections without a valid client certificate are rejected at the TLS level. When false, a certificate is requested but the connection proceeds even if none is provided (useful for optional client identification).

---

TlsConfig

Top-level TLS configuration for the Elide HTTP server.

Controls certificate provisioning, protocol versions, cipher suites, OCSP stapling, and mutual TLS. Applies server-wide unless overridden at the server-block level via TlsBlockOverride.

Example (automatic ACME)

pkl
new TlsConfig {
  auto = true
  acmeEmail = "ops@example.com"
}

Example (manual certificate)

pkl
new TlsConfig {
  auto = false
  certFile = "/etc/ssl/example.com.pem"
  keyFile  = "/etc/ssl/example.com-key.pem"
}
FieldTypeDefaultDescription
autoBooleantrueEnable automatic HTTPS via the ACME protocol.
acmeCAUri"https://acme-v02.api.letsencrypt.org/directory"Primary ACME Certificate Authority directory URL.
acmeCAFallbackUri"https://acme.zerossl.com/v2/DV90"Fallback ACME CA used when acmeCA is unreachable or returns an
acmeEmailString?nullEmail address registered with the ACME CA.
onDemandOnDemandTls?nullOn-demand TLS configuration.
tailscaleBooleanfalseUse the Tailscale certificate authority instead of a public ACME CA.
certFileString?nullPath to a PEM-encoded certificate file for manual TLS provisioning.
keyFileString?nullPath to the PEM-encoded private key file corresponding to certFile.
minVersionTlsVersion"1.2"Minimum TLS protocol version accepted by listeners.
cipherSuitesCipherSuitePreset"default"Named cipher-suite preset applied during TLS negotiation.
ocspStaplingBooleantrueEnable OCSP stapling.
storageCertStorage(empty)Persistent storage backend for certificates and ACME state.
dnsChallengeDnsChallenge?nullDNS-01 ACME challenge configuration.
clientAuthClientAuth?nullMutual TLS (mTLS) client-certificate authentication.

auto

Enable automatic HTTPS via the ACME protocol.

When true (default), Elide obtains and renews certificates automatically for all domain names listed in ServerBlock.domains. The server must be reachable on port 80 (for HTTP-01 challenges) unless dnsChallenge is configured for DNS-01 challenges.

acmeCA

Primary ACME Certificate Authority directory URL.

Defaults to the Let's Encrypt production endpoint. Switch to the staging URL while testing to avoid hitting production rate limits:
pkl
`"https://acme-staging-v02.api.letsencrypt.org/directory"`

acmeCAFallback

Fallback ACME CA used when acmeCA is unreachable or returns an error.

Defaults to ZeroSSL. Set to null to disable fallback.

acmeEmail

Email address registered with the ACME CA.

Used for certificate expiry warnings and account recovery. Required by most public ACME CAs (Let's Encrypt, ZeroSSL).

onDemand

On-demand TLS configuration.

When set, certificates are issued at TLS-handshake time for hostnames not covered by ServerBlock.domains. When null (default), on-demand issuance is disabled. See OnDemandTls.

tailscale

Use the Tailscale certificate authority instead of a public ACME CA.

Requires tailscaled to be running and the machine to be enrolled in a Tailnet. Certificates are issued for the machine's Tailscale FQDN.

certFile

Path to a PEM-encoded certificate file for manual TLS provisioning.

When provided, this certificate is used instead of ACME for domains served from the root TLS config. Must be paired with keyFile.

keyFile

Path to the PEM-encoded private key file corresponding to certFile.

Required when certFile is set; ignored otherwise.

minVersion

Minimum TLS protocol version accepted by listeners.

"1.3" is strongly recommended for public-facing servers. "1.2" (default) retains broader client compatibility.

cipherSuites

Named cipher-suite preset applied during TLS negotiation.

See CipherSuitePreset for available presets.

ocspStapling

Enable OCSP stapling.

When true (default), the server fetches and embeds OCSP responses in the TLS handshake, reducing client-side latency by eliminating a separate OCSP lookup.

storage

Persistent storage backend for certificates and ACME state.

See CertStorage for path configuration.

dnsChallenge

DNS-01 ACME challenge configuration.

When set (and auto = true), certificates are obtained via DNS TXT records instead of the default HTTP-01 challenge. Required for wildcard certificates. See DnsChallenge.

clientAuth

Mutual TLS (mTLS) client-certificate authentication.

Configures client certificate verification at the root TLS level. Per-server-block overrides can be set via TlsBlockOverride.clientAuth. See ClientAuth.

---