Skip to content

Edge and TLS

André Borchert edited this page Aug 23, 2026 · 9 revisions

Edge and TLS

Design stage. Nothing here is implemented.

Caddy is the web server, on port 8877, because ports 80 and 443 belong to other services on this VPS. Latest Caddy from the official apt repository — not a distribution or Homebrew build, both of which lag.

The certificate problem

This is the one genuinely hard constraint in the deployment, and it needs solving before anything else on this page matters.

Let's Encrypt will not validate on port 8877. It offers exactly three challenge types, and all three are closed here:

Challenge Requires Status
HTTP-01 Inbound on port 80 Taken by another service
TLS-ALPN-01 Inbound on port 443 Taken by another service
DNS-01 A TXT record at _acme-challenge.<domain> Impossible — nip.io is not our DNS zone

The nip.io address is what makes this a dead end rather than an inconvenience. It is a public wildcard resolver that maps pummelchen.91.99.176.243.nip.io to the embedded IP; nobody outside its operators can publish records under it. Every DNS-based workaround is therefore unavailable, no matter which ACME client is used.

So Caddy cannot obtain this certificate itself. It has to be given one.

Options, ranked

1. Use a domain we control — recommended

Point a real domain at the VPS and issue via DNS-01 through its provider. Caddy on 8877 then renews its own certificate with no dependency on ports 80 or 443 at all.

This removes the entire class of problem permanently rather than working around it, costs a few euros a year, and produces a URL players can actually remember. It also ends the awkwardness of a public site whose address contains a raw IP.

2. Borrow a certificate from whatever owns 443 — works today

Whatever already holds 443 is presumably renewing certificates for its own hostnames. Have it also issue for pummelchen.91.99.176.243.nip.io, and point Caddy at the resulting files:

tls /etc/pummelchen/tls/cert.pem /etc/pummelchen/tls/key.pem

Caddy serves TLS on 8877, including HTTP/3, using a certificate it did not obtain. Caddy does not watch certificate files for changes, so renewal must trigger caddy reload — a deploy hook or a systemd path unit watching the certificate. Without that, the site silently serves an expired certificate at the next renewal.

3. Proxy the ACME challenge path — fiddly but viable

Configure whatever owns port 80 to forward /.well-known/acme-challenge/* for this hostname to Caddy, and set Caddy's global http_port to the port it forwards to. Caddy then solves HTTP-01 itself.

This works, but it couples our certificate renewal to another service's configuration, and it fails quietly if that configuration is ever changed by someone who does not know why the route exists.

Not acceptable

tls internal issues from Caddy's own CA. Every visitor gets a browser warning. Fine for local tests, never for a player-facing site.

The URL needs a port

Stated plainly because it conflicts with the address as given: https://pummelchen.91.99.176.243.nip.io resolves to port 443, which is another service. The working address is:

https://pummelchen.91.99.176.243.nip.io:8877

The clean, port-free URL is only achievable if something on 443 forwards to us, or if option 1 is taken and that domain's 443 is ours. Worth deciding deliberately — a URL with a port in it is a URL players will mistype.

HTTP/3 and QUIC

HTTP/3 is enabled by default in Caddy 2.6 and later; the old experimental_http3 flag no longer exists. Being explicit costs nothing:

{
	servers {
		protocols h1 h2 h3
	}
}

Two operational requirements that are easy to miss:

  • UDP 8877 must be open in the firewall. HTTP/3 runs over QUIC on UDP, on the same port number as the TCP listener. Opening only TCP produces a site that works while silently never using HTTP/3.
  • The first request is always TCP. The browser learns about HTTP/3 from the Alt-Svc header on that first response and upgrades subsequent connections. There is no way to skip the TCP handshake on a cold visit.

HTTP/3 on a non-standard port is otherwise unremarkable — QUIC carries the port in the same way TCP does.

Configuration shape

{
	servers {
		protocols h1 h2 h3
	}
}

https://pummelchen.91.99.176.243.nip.io:8877 {
	tls /etc/pummelchen/tls/cert.pem /etc/pummelchen/tls/key.pem

	encode zstd gzip

	header {
		-Server
		Strict-Transport-Security "max-age=31536000"
		X-Content-Type-Options "nosniff"
		X-Frame-Options "DENY"
		Referrer-Policy "no-referrer"
	}

	handle /api/* {
		header Cache-Control "no-store, max-age=0"
		reverse_proxy 127.0.0.1:8787
	}

	handle {
		root * /var/minecraftai/web/site/public
		try_files {path} {path}/ /index.html
		file_server
	}
}

One reverse-proxy target, not three. The engine serves every Minecraft version from a single loopback API, so adding a version changes no Caddy configuration at all — see Adding a Version.

The security headers, the no-store policy on API responses and the blocking of sensitive file patterns are carried over from v1, whose edge test suite is worth resurrecting as the starting point for this one.

Installing latest Caddy

Debian's packaged Caddy and Homebrew's both lag behind release. Use the official repository so HTTP/3 fixes and QUIC improvements arrive:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' \
  | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' \
  | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update && sudo apt install caddy

The development machine should pin the same major version, so edge tests exercise the behaviour production actually has.

Clone this wiki locally