Disclosure up front: I run IPYE, a company that leases IP space. Most of this article is practical how-to; IPYE appears where a free /48, LOA, or ROA helps you try the work, with a short call to action at the end.
Caddy obtains and renews certificates automatically and serves HTTPS with sensible defaults, which makes it one of the quickest ways to publish a site. It also handles IPv6 cleanly, including binding a site to a specific address. That is useful when a server holds several addresses from your own prefix and each service should have its own. This guide runs Caddy on a server numbered from a free IPv6 /48 from IPYE, with app.example.net on 2001:db8:100:10::30.
DNS first
Caddy's automatic HTTPS needs the name to resolve to the server before it starts:
app.example.net. AAAA 2001:db8:100:10::30
Add an A record too if the site should be reachable over IPv4. With only an AAAA record, the site and its certificate validation are IPv6-only, which is perfectly valid but rules out IPv4-only visitors.
A minimal Caddyfile
app.example.net {
bind 2001:db8:100:10::30
reverse_proxy [::1]:3000
encode zstd gzip
log {
output file /var/log/caddy/app.log
}
}
bind restricts the site's listeners to one address. Without it Caddy listens on all addresses, which is fine on a single-purpose server but not when another service owns ports 80 and 443 on a different address of the same host. reverse_proxy [::1]:3000 forwards requests to an application listening on IPv6 loopback; the brackets are required around IPv6 literals with a port.
Caddy manages both ports itself: port 80 for HTTP-to-HTTPS redirects and certificate challenges, port 443 for HTTPS. Recent versions also listen on UDP port 443 for HTTP/3, so open UDP 443 in the firewall for the bound address if you want clients to upgrade to it.
The backend listening on [::1] is a small but useful habit. The application is then reachable only through Caddy on the same host, and you do not need any firewall rule for port 3000 at all.
Several sites on several addresses
app.example.net {
bind 2001:db8:100:10::30
reverse_proxy [::1]:3000
}
docs.example.net {
bind 2001:db8:100:10::31
root * /srv/docs
file_server
}
Each site now has its own address. Logs, firewall rules and rate limits can be applied per address, and moving one site to another server later means moving its address and DNS record without touching the other.
Binding to both families
If the site should also answer on IPv4, list both addresses:
bind 2001:db8:100:10::30 192.0.2.30
Check the listeners
caddy validate --config /etc/caddy/Caddyfile
systemctl reload caddy
ss -tlnp | grep caddy
caddy validate parses the configuration without applying it. After the reload, ss should show [2001:db8:100:10::30]:443 and :80. If it shows *:443, the bind line did not apply to that site.
Certificate issuance over IPv6
With an AAAA record, the certificate authority validates over IPv6, so ports 80 and 443 must be reachable on the bound address from the Internet. Caddy can use either the HTTP or the TLS-ALPN challenge; both need inbound access to the address. If issuance fails, the Caddy log names the challenge and the error. Confirm from an outside host:
curl -6 -v http://app.example.net/
A redirect to HTTPS means Caddy is reachable on port 80. A timeout points at routing or a firewall.
Real client addresses
Caddy passes the client address to backends in the X-Forwarded-For header by default, and IPv6 client addresses appear there in full. Make sure your application's logging and rate-limiting code accepts IPv6 addresses and, for rate limits, consider grouping by /64, since a single IPv6 user typically controls a whole /64.
Run it safely
The packaged systemd unit runs Caddy as an unprivileged user with the capability to bind ports below 1024. Keep it that way rather than running Caddy as root. Caddy stores certificates and keys in its data directory, so back that directory up or accept that a rebuilt server will request new certificates.
The route to the address
The bound address only receives traffic if the /48 is announced and routed to your server's network. The upstream needs the LOA from the IPYE dashboard, and the ROA IPYE creates validates the announcement.
Next step
Claim your free /48, give each Caddy site its own address with bind, and run caddy validate before every reload. Questions: ipye@turnel.com.
About IPYE
IPYE (https://ipye.com) leases IPv4, IPv6 and ASN space with instant setup. Your first IPv6 /48 is free for the first year, a real allocation you can announce on your own ASN, with a LOA from the portal and the ROA created automatically. ASN and region changes apply automatically. IPv4 /24 to /22 leases include LOA, ROA and per-/24 rDNS; WHOIS is editable on IPv6 /44 and larger. Locations: Los Angeles, New York, Ashburn, Salt Lake City, London, Amsterdam, Frankfurt. Claim your free /48: https://my.ipye.com/products/ipv6-rental. Questions: ipye@turnel.com.
Disclosure: I run IPYE
Top comments (0)