Recipes

Caddy

Automatic-HTTPS reverse proxy — OKE_PROXY_HOST, Caddyfile, /data certificate volume, single-instance compose.

Caddy is the simplest TLS path — automatic HTTPS from a generated Caddyfile, no certificate management by hand. Right choice for a single app instance without --scale.

The one rule

Leave images.proxy unset until you need HTTPS at the edge or --scale app=N. Once set, app stops publishing its host port directly — Caddy (or Traefik) does.

Quick start

Pin the proxy

oke.config.ts
images: {
  proxy: "caddy:2-alpine",
},

Set the public hostname

.env.local
OKE_PROXY_HOST=app.example.com

Unset defaults to localhost — Caddy issues a local TLS cert instead of Let's Encrypt.

Include the proxy layer

docker compose -f docker-compose.yml up -d

Generated Caddyfile: {$OKE_PROXY_HOST:localhost} { reverse_proxy app:6530 }.

Required env

VariableRequired?Meaning
OKE_PROXY_HOSTRecommendedPublic hostname for ACME; default localhost → local TLS only
allowedHosts (config)ProductionMust include the public hostname — see Security

Caddy has no separate ACME email env in this recipe (unlike Traefik's OKE_PROXY_ACME_EMAIL).

Data and backup

VolumePathWhat it stores
proxy-data/dataACME certificates, account keys
proxy-config/configCaddy runtime config
Bind mount./Caddyfile/etc/caddy/Caddyfile:roGenerated site block

Backup means: preserve the proxy-data named volume (and ideally proxy-config) so Let's Encrypt rate limits and cert renewals survive recreates. Losing /data forces re-issuance. The Caddyfile is regenerated by oke docker.

Production note

Caddy has no service-discovery story for multiple app replicas. Once you run docker compose up --scale app=N, switch to Traefik — it discovers replicas from Docker labels instead of a static reverse_proxy target.

Also set allowedHosts to your public hostname before exposing the edge — see Security.

What the recipe configures

FieldValue
Ports80 + 443 published; app stays internal
Healthcheckcaddy version, every 10s, 5 retries
Connection URLhttps://<host>

Troubleshooting

Learn more

  • Traefik — multi-replica discovery via Docker labels
  • nginx — static HTTP reverse proxy
  • SecurityallowedHosts

Next

On this page