DEV Community

Alex Spinov
Alex Spinov

Posted on

Caddy Has a Free API — Zero-Config HTTPS Web Server

Caddy: Automatic HTTPS, Zero Config

Caddy provisions and renews TLS certificates automatically via Lets Encrypt. No cert management, no expired certs, no nginx config nightmares.

Why Caddy

  • Automatic HTTPS — certs auto-provisioned
  • Zero config for basic use
  • HTTP/3 and QUIC built-in
  • JSON REST API for config
  • Single binary, no deps

The Free API

# Get config
curl http://localhost:2019/config/

# Set reverse proxy
curl -X POST http://localhost:2019/load \
  -H "Content-Type: application/json" \
  -d @caddy.json
Enter fullscreen mode Exit fullscreen mode

Caddyfile

api.example.com {
    reverse_proxy localhost:8080
}

example.com {
    root * /var/www/html
    file_server
    encode gzip
}
Enter fullscreen mode Exit fullscreen mode

Real-World Use Case

50 microservices with nginx had 3 cert expiry incidents/year. Caddy: zero cert management, auto renewals, API config. Zero incidents since.

Quick Start

brew install caddy
caddy reverse-proxy --from :443 --to :8080
Enter fullscreen mode Exit fullscreen mode

Resources


Need web infrastructure automation? Check out my tools on Apify or email spinov001@gmail.com.

Top comments (0)