I love caddy, I used to litter my docker-compose.yaml files with Traefik labels like:
labels:
- traefik.enable=true
- traefik.http.routers.foundryvtt-http.entrypoints=web
- traefik.http.routers.foundryvtt-http.rule=Host(`vtt.xxx.nl`)
- traefik.http.routers.foundryvtt-http.middlewares=foundryvtt-https
- traefik.http.middlewares.foundryvtt-https.redirectscheme.scheme=https
- traefik.http.routers.foundryvtt.middlewares=foundryvtt-auth
- traefik.http.middlewares.foundryvtt-auth.basicauth.users=${foundryvtt-BASIC_AUTH}
- traefik.http.routers.foundryvtt.entrypoints=websecure
- traefik.http.routers.foundryvtt.rule=Host(`vtt.xxx.nl`)
- traefik.http.routers.foundryvtt.tls=true
- traefik.http.routers.foundryvtt.tls.certresolver=mytlschallenge
- traefik.http.services.foundryvtt.loadbalancer.server.port=30000
Now I just add the containers (by name), no labels, and map Caddy to their port, like so (in the Caddyfile):
data.xxx.com {
reverse_proxy projectsend:80
}
or, this snippet refers to a WordPress container with BasicAuth in front of it:
restricted.xxxx.com {
root * /var/www/html/restricted.xxxx.com/wordpress
php_fastcgi wordpress-xxxx-restricted:9000 {
root /var/www/html
}
basicauth /* {
xxx $xx$x05xxxxxxxxx.xx
}
file_server
}
Here's just an index.html (from Hugo in this case) in some dir:
blog.xxx.nl {
# Set this path to your site's directory.
root * /var/www/html/blog.xxx.nl
# Enable the static file server.
file_server
}
I love the simplicity.