Is it possible to use caddy to retrieve a LE certificate for something else than a web site?

(Caddy v2)

I use Caddy as a reverse proxy for my containers (it runs itself in a container). Everything works fine.

I also run a MQTT broker - this is a bus to which one can connect and listen to topics or post to them (I just mention this so that it is clear it has nothing to do with caddy).

Until now I was using it in its equivalent of a HTTP connection - without certificates.

I now need to add certificates so that a HTTPS SPA can access its secure web sockets.

One of the magic in caddy (one of many :)) is the automatic LE use to retrieve certificates for HTTPS web sites.

Would there be a mechanism where I could retrieve the certfile, cafile and keyfile for something that is not a web site and store them somewhere so that they can be used by another program? (such as my MQTT broker in my case)


Thank you very much @matt.

I also realized when reading my question again that I can simply proxy the ws://... traffic via caddy to immediately get a wss://... one.

After having set up the proxy, I realized that I actually need to get the certificates. I went to your post and the JSON configuration is clear.

Is there a way to set the equivalent in a Caddyfile? All the documentation I found refers to the JSON configuration only.

The Caddyfile is for configuring sites to serve. If you don’t want to serve any sites, I think you’ll have to use JSON.

This topic was automatically closed after 30 days. New replies are no longer allowed.