The HTTPS Problem
Setting up HTTPS with Nginx:
- Install Nginx
- Install Certbot
- Run Certbot to get Let's Encrypt certificate
- Configure Nginx with SSL paths
- Set up cron job for certificate renewal
- Handle redirect from HTTP to HTTPS
Caddy does all of this automatically. Point it at a domain, it handles the rest.
What Caddy Gives You
Automatic HTTPS
# Caddyfile — that's the ENTIRE config
example.com {
reverse_proxy localhost:3000
}
Caddy automatically:
- Gets a Let's Encrypt certificate
- Redirects HTTP → HTTPS
- Renews certificates before they expire
- Configures OCSP stapling
- Uses modern TLS settings
Reverse Proxy
example.com {
reverse_proxy /api/* localhost:8080
reverse_proxy /ws/* localhost:8081
root * /var/www/html
file_server
}
Load Balancing
example.com {
reverse_proxy localhost:3001 localhost:3002 localhost:3003 {
lb_policy round_robin
health_uri /health
health_interval 10s
}
}
SPA Routing
example.com {
root * /var/www/app
try_files {path} /index.html
file_server
}
Perfect for React, Vue, Angular — all 404s fall back to index.html.
API Config (JSON)
curl localhost:2019/config/ -d '{
"apps": {
"http": {
"servers": {
"main": {
"listen": [":443"],
"routes": [{
"handle": [{
"handler": "reverse_proxy",
"upstreams": [{"dial": "localhost:3000"}]
}]
}]
}
}
}
}
}'
Update configuration at runtime via API. No restarts. No downtime.
Quick Start
# Install
brew install caddy # or apt, yum, docker
# Serve current directory
caddy file-server --listen :8080
# Reverse proxy with auto-HTTPS
caddy reverse-proxy --to localhost:3000
Why This Matters
HTTPS shouldn't require 6 steps and 3 tools. Caddy makes TLS automatic, so you can focus on your application instead of your certificate infrastructure.
Serving web data APIs? Check out my web scraping actors on Apify Store — structured data for your applications. For custom solutions, email spinov001@gmail.com.
Top comments (0)