Verify return code: 20 (unable to get local issuer certificate). The certificate was valid. The server was up, the name matched, and curl on the machine running Caddy connected without a complaint. Checked against any trust store but that machine’s own, the same server returned that error, because Caddy had quietly made its own certificate authority and installed it on exactly one computer: the box it was running on. Automatic HTTPS is automatic right up to the edge of the machine.
Every command and log line below was run on an Ubuntu 24.04 test container with Caddy 2.6.2, the version Ubuntu’s own repository ships, which is older than the current release on Caddy’s site. A small Python web server on port 8080 stood in for a self-hosted app. One thing could not be tested here: the container’s network policy blocks Let’s Encrypt, so the public-certificate path is described from Caddy’s and Let’s Encrypt’s documentation, and the container’s attempt at it is shown as the failure it was.
The four-line Caddyfile
Name, certificate source, upstream, done
A reverse proxy sits in front of an app, takes the HTTPS connection from the browser, and passes the request along to the app on a local port. Caddy’s pitch is that it also gets and renews the certificate on its own. The config for an internal app:
app.home.arpa {
tls internal
reverse_proxy 127.0.0.1:8080
}
For a public domain whose DNS points at the server, drop the tls internal line and it becomes three. caddy fmt returned the file unchanged and caddy validate printed Valid configuration. Then caddy adapt --pretty showed what those lines become underneath: about sixty lines of JSON, with a server listening on :443, a route matching the host app.home.arpa, a reverse_proxy handler dialing 127.0.0.1:8080, and a TLS automation policy with the internal issuer. The Caddyfile is the front panel on a breaker box; the JSON is the wiring behind it.
.home.arpa was not chosen at random. Caddy’s automatic HTTPS documentation lists it with .localhost, .local and .internal among the TLDs that cannot get publicly trusted certificates, and it gives local and internal hostnames like these self-signed certificates instead, trusted locally where the system allows it.

What Caddy did on startup
It built a certificate authority before serving the first page
Caddy logged its startup as JSON. The messages, in the order they appeared, with the noise trimmed:
"msg":"enabling automatic HTTP->HTTPS redirects"
"msg":"enabling HTTP/3 listener"
"msg":"server running"
"msg":"enabling automatic TLS certificate management"
"msg":"obtaining certificate"
"msg":"certificate obtained successfully"
"msg":"installing root certificate (you might be prompted for password)"
"msg":"certificate installed properly in NSS security databases"
"msg":"certificate installed properly in linux trusts"
Two things happened that the four-line file never asked for. Caddy created a local root certificate and an intermediate and issued a leaf certificate for app.home.arpa from that intermediate. It also wrote the root into the system’s trust stores, which only works because it ran with root privileges. Reading the certificates back with openssl:
leaf: issuer=CN = Caddy Local Authority - ECC Intermediate
X509v3 Subject Alternative Name: critical DNS:app.home.arpa
validity: 12 hours
root: subject=CN = Caddy Local Authority - 2026 ECC Root
validity: about 10 years
A twelve-hour certificate is a strange thing to hand a browser, and it is the point. Caddy renews it in the background long before anyone notices, so a stolen copy goes stale by dinner. The docs say intermediates “have a much shorter lifetime” than the root and are renewed as needed.
The proxy itself:
$ curl --resolve app.home.arpa:443:127.0.0.1 https://app.home.arpa/
<h1>backend on 8080</h1>
HTTP 200 via 2
$ curl -I http://app.home.arpa/
HTTP/1.1 308 Permanent Redirect
Location: https://app.home.arpa/
HTTP/2 to the client, a 308 redirect on port 80, and an alt-svc: h3=":443" header advertising HTTP/3. A replacement backend that echoed back what it received showed the headers Caddy adds on the way in:
client_address=127.0.0.1
Host: app.home.arpa
X-Forwarded-For: 127.0.0.1
X-Forwarded-Host: app.home.arpa
X-Forwarded-Proto: https
That matches the reverse_proxy documentation, which says the proxy “sets or augments the X-Forwarded-For header field” and sets X-Forwarded-Proto and X-Forwarded-Host, and that by default it will “ignore their values from incoming requests, to prevent spoofing.”
How ACME gets a public certificate
Prove control of the name, then sign the paperwork
A real domain means ACME, the protocol published as RFC 8555 in March 2019 and described there as “an extensible framework for automating the issuance and domain validation procedure.” The RFC’s overview lays out the sequence: an account, then an order, then the client has to “prove control of any identifiers requested in the certificate,” then it finalizes the order by sending a certificate signing request and downloads the result.
The proof carries all the weight. Let’s Encrypt’s challenge types page lists three:
| Challenge | How the CA checks | Port | Wildcards |
|---|---|---|---|
| HTTP-01 | Fetches a token file from the server | 80 only | No |
| TLS-ALPN-01 | Special TLS handshake | 443 | No |
| DNS-01 | Looks up a TXT record | None inbound | Yes |
The page is blunt about the first: “The HTTP-01 challenge can only be done on port 80.” Caddy enables the HTTP and TLS-ALPN challenges by default, per its docs, and DNS needs provider credentials. The requirements for a public certificate, in Caddy’s words: the domain’s “A/AAAA records point to your server,” ports 80 and 443 “are open externally,” and the data directory is “writeable and persistent.”
When it fails, it fails quietly. The docs say certificate management runs “in the background,” so Caddy starts serving even without a certificate. If Let’s Encrypt fails it tries ZeroSSL, then backs off exponentially, with at most one day between attempts, for up to 30 days, and it switches to Let’s Encrypt’s staging environment while retrying. The container’s own attempt, pointed at Let’s Encrypt staging for the reserved name homelab.example, never reached the CA:
tls.obtain | could not get certificate from issuer | registering account [] with server:
provisioning client: performing request: Get "https://acme-staging-v02.api.letsencrypt.org/directory":
Forbidden (agent proxy: no rule or network setting allows this host)
tls.obtain | will retry
The sandbox’s network policy blocked it, not Let’s Encrypt. The shape is still instructive: one error line, one “will retry,” and a server that keeps running while handing out no valid certificate.

Where people get burned
Port 80, a lost data folder, and a root nobody else trusts
The blocked port. Some residential ISPs block inbound port 80, and HTTP-01 cannot move. On the Caddy forum, a 2022 thread from a user whose ISP blocked the port ends with Francis Lavoie stating that “ACME issuers never make the challenge verification request on non-standard ports.” Changing Caddy’s http_port only helps if a router forwards external 80 to it. The user in that thread switched to the DNS challenge, which meant recompiling Caddy with xcaddy and the Cloudflare DNS plugin.
The lost data directory. In Docker, the official Caddy image page warns that “it’s very important to persist the data directory,” which holds “TLS certificates, private keys, OCSP staples,” and “must not be treated as a cache.” Rebuild a container without a volume a few times in an afternoon and every start requests fresh certificates. Let’s Encrypt’s rate limits page says “Up to 5 certificates can be issued per exact same set of identifiers every 7 days,” and caps authorization failures at five per identifier per account every hour. Caddy’s docs warn that testing against production can “block your access to HTTPS for up to a week.” The Docker Compose self-hosting guide covers named volumes for exactly this reason.
The local root. This is the error at the top. With tls internal, the test container trusted Caddy’s root because Caddy installed it there. Checked against only the public ISRG Root X1 bundle, the same server failed:
Verify return code: 20 (unable to get local issuer certificate)
With Caddy’s root.crt supplied as the trust anchor: Verify return code: 0 (ok). Every phone, laptop and TV that talks to the service needs that root file installed by hand, and if the data directory is wiped, Caddy makes a new root and every device has to be done again.
Something else on the port. Caddy needs 80 and 443. If an old nginx, a forgotten Docker container or a NAS web interface already holds one of them, Caddy fails to bind. ss -ltnp names the process holding the port.
The case against making it this easy
Automatic until the day it isn’t, and then nobody remembers how it works
The strongest argument against Caddy’s approach is the same as the argument for it. The four-line file hides an account, a key pair, a challenge, a private CA, a trust-store write and a renewal scheduler. When all of it works, nobody needs to know. When it breaks, at 2 a.m. or on day 31 of a backoff loop, the person staring at the log has never seen an ACME order. Certbot users at least learned where the certificates live, which is most of what the Certbot troubleshooting guide depends on.
The second cost is exposure. Public certificates through HTTP-01 or TLS-ALPN-01 mean ports 80 and 443 open to the whole internet, on a home connection, so a lab service can have a padlock. DNS-01 avoids that, but Let’s Encrypt’s own page says “keeping API credentials on your web server is risky,” and a DNS API token often controls the whole domain, not one record. tls internal keeps everything inside and moves the cost to installing a root on every device. None of the three is free. Shorter certificate lifetimes, covered in the 64-day certificates post, only raise the stakes on whichever one is chosen. Anyone still weighing Caddy against Traefik or Nginx Proxy Manager can find the configuration models compared in this home-lab comparison.
Caddy will keep trying for thirty days, politely, with a growing gap between attempts and a log line each time. Most home labs have no alerting on that log. If a Caddy box in a closet failed its renewal last Tuesday, what on the network would notice before the certificate expired?

Sources
- Caddy, Automatic HTTPS: https://caddyserver.com/docs/automatic-https
- Caddy, reverse_proxy directive: https://caddyserver.com/docs/caddyfile/directives/reverse_proxy
- RFC 8555, Automatic Certificate Management Environment (ACME), March 2019: https://www.rfc-editor.org/rfc/rfc8555
- Let’s Encrypt, Challenge Types: https://letsencrypt.org/docs/challenge-types/
- Let’s Encrypt, Rate Limits: https://letsencrypt.org/docs/rate-limits/
- Caddy Community, ACME HTTP01 challenge on a non-80 port (June 2022): https://caddy.community/t/acme-http01-challenge-on-a-non-80-port/16412
- Docker Hub, Caddy official image: https://hub.docker.com/_/caddy
