Caddy
An extensible web server and reverse proxy with automatic HTTPS, configuration APIs, modules, and HTTP/3 support.
Why consider Caddy?
An extensible, open-source web server written in Go that automatically provisions and renews TLS certificates by default.
Learn Caddy by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide3 sections
Caddy is an open-source web server written in Go that differentiates itself by automatically handling TLS certificate provisioning and renewals out of the box. As described in the project repository, it acts as an extensible platform that uses TLS by default. Instead of requiring external tools or cron jobs to manage certificates, the server handles these negotiations internally.
Core Configuration Architecture
At its core, Caddy operates on a dynamic JSON structure. The getting started documentation explains that its configuration is natively just a JSON document. Unlike traditional static text configurations, this native format allows the server to be completely programmable at runtime. You can update routing rules, add new virtual hosts, or change load balancing policies via the server's REST API without restarting the process or dropping existing connections.
Because JSON can be verbose for human operators, the project provides a simpler configuration language called the Caddyfile. When you launch the server using a Caddyfile, a built-in config adapter automatically converts the human-readable text into the native JSON structure the server requires. This layered approach means you can use the simpler format for everyday deployments, but switch to the JSON API for automated or complex infrastructure.
Operating as a Reverse Proxy
One of the most common workflows is placing Caddy in front of internal application servers. The built-in reverse proxy module can handle load balancing, health checks, and automatic header management.
For simple local development or quick testing, the reverse proxy guide notes that you can bypass configuration files entirely and run the proxy directly from your terminal. The following command binds the server to port 2080 and forwards all traffic to a backend service running on port 9000:
caddy reverse-proxy --from :2080 --to :9000By supplying a domain name instead of a local port, the server automatically provisions the necessary certificates. Caddy serves the proxy over HTTPS automatically and by default if it knows the target hostname, meaning you don't need additional steps to secure the connection.
Setup and Verification Steps
When you supply a configuration file, the daemon will load it and begin listening on the specified ports. If you are using the JSON format, you must POST the file to the administration endpoint:
- Create your
caddy.jsonfile. - Start the daemon using
caddy run. - Submit the configuration via
curl localhost:2019/load -H "Content-Type: application/json" -d @caddy.json.
Alternatively, if you are relying on the adapter, placing a file named Caddyfile in your working directory and running caddy run will automatically parse and apply the rules. To apply updates without downtime, running caddy reload evaluates the new configuration and gracefully swaps the active routing table while preserving active connections.
If the new configuration fails to load, the server aborts the update and rolls back to the old configuration to prevent downtime, preventing a bad update from taking your site offline.
Related tools
More options with a similar category or technology profile.
diskus
Minimal, fast alternative to du -sh written in Rust using multi-threaded directory traversal.
peco
Simplistic interactive filtering tool for Unix pipelines, process lists, and file trees.
Dapr CLI
Command-line tool for managing Dapr distributed application runtime environments and sidecars.
Freeze
Generate beautiful image screenshots and SVGs of code snippets and terminal outputs.