I’m using Caddy to serve a couple of sites/services, usually by forwarding them to a docker container. For this I’m using a Caddyfile. I would really like to keep the Caddyfile to configure the sites, in fact one of my main reasons to switch from nginx to Caddy was that adding a site in Caddy is 3 lines while in nginx it’s 30 or so.
But now I would like to use the same* Caddy to terminate SSL (TLS) for an MQTT server. I think this is possible using the layer4
app, but I also think the layer4
app can only be configured using JSON.
Now I’m not sure what would be the best way to plug these together. I could probably hack together a shell script that uses caddy adapt
and jq
to build a final JSON config, but this comment in a thread about a similar use case somewhat suggests there might be a better, caddy-internal solution?
What would be your advice?
* I could run another Caddy on a port other than 443, but I vaguely remember that it breaks the Let’s encrypt challenges.