Follow us
Breaking
Web Hosting

How Caddy is changing automatic HTTPS for hosting providers

Caddy simplifies web hosting by providing automatic HTTPS and memory safety via Go. Benchmarks show Caddy using only 5% CPU for 1,000 requests per second on an 8-core machine, offering a streamlined alternative to Nginx and Traefik.

Share

Caddy manages SSL/TLS certificates through Let’s Encrypt and ZeroSSL without manual intervention. Nginx requires additional configuration for these features and often needs external tools like Certbot to handle ACME challenges. Caddy provides automatic HTTPS by default for all sites. The Caddy configuration format, the Caddyfile, reduces file length compared to Nginx. Nginx configuration is often verbose, requiring users to explicitly enable features like HTTP/2 or manage directory paths for ACME challenges manually. Some users argue that Nginx is more transparent because it spells out every line, whereas the Caddyfile is too brief and means nothing without a manual. Caddy aims to be right for 90% of site owners with modern security settings included out of the box. Caddy allows a user to list a domain name to serve it over HTTPS with both ports 80 and 443. The Caddy "transparent" directive replaces several Nginx lines used to set headers for a reverse proxy. This directive replaces proxy_set_header X-Real-IP $remote_addr;, proxy_set_header Host $http_host;, proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;, and proxy_set_header X-Forwarded-Proto https; with a single preset. This preset includes header_upstream Host {host}, header_upstream X-Real-IP {remote}, header_upstream X-Forwarded-For {remote}, and header_upstream X-Forwarded-Proto {scheme}. This eliminates the work of adding headers manually to a reverse proxy. Caddy is written in Go, which provides memory safety that C programs like Nginx do not have.

Performance metrics and microservice handling

Traefik excels in dynamic microservice environments because it watches Docker labels and Kubernetes Ingress resources to pick up new containers. This allows it to handle services that scale up and down without a restart or configuration change. Caddy does not have native integration with container orchestrators, though the caddy-docker-proxy community plugin provides Docker label support. Nginx remains static by default and requires external tools like consul-template or nginx-proxy to generate configurations dynamically. You know that Nginx requires explicit headers for websocket proxying, whereas Caddy and Traefik handle these connections transparently. While Traefik provides advanced service discovery for Docker Swarm and Kubernetes users, Caddy focuses on a single binary that provides security defaults like HTTP/2 and QUIC support without requiring external dependencies or complex configuration files.

Performance results vary depending on the hardware and workload. In one benchmark, Caddy used 5% CPU for 1,000 requests per second on an 8-core machine, whereas Nginx used 100% CPU for the same load. This occurred on a c5.xlarge machine with 4 cores per host. Another test with 20,000 clients per second showed Caddy used 20% CPU. However, other tests show Nginx is faster for synthetic requests and large HTML responses. One user reported that Caddy download speeds dropped from 9500 to 5400 when using HTTPS. Traefik v3 includes a "FastProxy" engine to address performance issues. In a test with 200 concurrent clients, Caddy had a median response time of 0.22ms for synthetic requests, while Nginx had a median of 0.18ms. In a different comparison, Caddy had a median response time of 1.93ms for large HTML responses, while Nginx had a median of 2.18ms. Caddy also uses more memory than Nginx because the Go runtime grabs a small amount of memory at startup.

Deployment stability in cluster environments

Caddy manages certificates in clusters by sharing a folder on disk, such as ~/.caddy. This setup allows multiple Caddy instances to synchronize certificate management so only one instance performs renewals via the DNS challenge. This prevents users from hitting Let’s Encrypt rate limits. Caddy provides load balancing with algorithms like round robin, least connection, and IP hash. Caddy can also serve as a reverse proxy to forward requests to backend servers, which allows users to enable HTTPS for applications that do not support it natively. For WordPress users facing traffic floods from Mastodon, Caddy can use a cache-handler plugin to store oembed responses on disk for five minutes. This prevents the database from being hit during a traffic storm. Nginx remains a choice for resource-constrained hardware or when users need advanced features like custom Lua scripting or GeoIP. Traefik remains the choice for microservices that scale dynamically or for users who need a built-in dashboard.

Feature Nginx Traefik Caddy
Language C Go Go
Config Format Custom DSL YAML/TOML/Labels Caddyfile/JSON
Auto TLS External/Modules Built-in Built-in

Nginx has weak sane defaults because it lacks TLS and OCSP stapling out of the box. Caddy is the better choice for administrators who want security and simplicity without manual configuration. Can Caddy match the specialized performance of Nginx under extreme custom workloads?

Share

Technewsdaily

Senior tech writer covering AI, gadgets and cybersecurity. Breaking down the news that matters, every day.