DOMAIN_SUFFIX=local (or any non-localhost LAN name) caused a TLS handshake
failure because Caddy attempted an ACME challenge that can never succeed for
private domains.
- Caddyfile: tls {$ACME_EMAIL:internal} — falls back to Caddy's built-in CA
when ACME_EMAIL is absent, uses Let's Encrypt when it is set.
- start.sh: ACME_EMAIL is now optional; missing it prints a warning instead
of aborting, so local/LAN setups work without an email address.
To trust the self-signed cert in a browser run: caddy trust
https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
39 lines
1.4 KiB
Caddyfile
39 lines
1.4 KiB
Caddyfile
# HIY — Caddyfile
|
|
#
|
|
# Caddy automatically obtains a Let's Encrypt certificate for every domain it
|
|
# serves (HTTP-01 challenge). No Cloudflare or DNS API token required.
|
|
#
|
|
# Requirements:
|
|
# - Ports 80 and 443 must be publicly reachable (router port-forward to Pi)
|
|
# - DNS A record for {$DOMAIN_SUFFIX} must point to your public IP
|
|
# - Set ACME_EMAIL in infra/.env (Let's Encrypt needs a contact address)
|
|
#
|
|
# Local dev: set DOMAIN_SUFFIX=localhost in infra/.env — Caddy will use a
|
|
# self-signed cert automatically for localhost.
|
|
{
|
|
# Admin API — used by hiy-server to add/remove app routes dynamically.
|
|
# Listens on all interfaces so the server container can reach it via Docker
|
|
# networking (http://caddy:2019). Port 2019 must NOT be port-forwarded on
|
|
# the host or router — see docker-compose.yml.
|
|
admin 0.0.0.0:2019
|
|
|
|
# Email for Let's Encrypt expiry notices (set ACME_EMAIL in .env).
|
|
email {$ACME_EMAIL:}
|
|
}
|
|
|
|
# HIY dashboard — served at your root domain.
|
|
# TLS behaviour:
|
|
# ACME_EMAIL set → Caddy requests a Let's Encrypt cert (production)
|
|
# ACME_EMAIL unset → Caddy uses its built-in internal CA (local / LAN domains)
|
|
{$DOMAIN_SUFFIX:localhost} {
|
|
tls {$ACME_EMAIL:internal}
|
|
reverse_proxy server:3000
|
|
}
|
|
|
|
# Deployed apps are added here dynamically by hiy-server via the Caddy API.
|
|
# Each entry looks like:
|
|
#
|
|
# myapp.{$DOMAIN_SUFFIX} {
|
|
# reverse_proxy <container-ip>:<port>
|
|
# }
|