README generated by Anthropic's Claude
A Caddy adapter that allows loading domain names from a hosts-like file into Caddyfile directives. This is really only useful when you have several domains that you want reverse proxied to the same endpoint.
@hosts_filepath /etc/caddy/hosts
@etc_hosts_filepath /etc/hosts
# Will load all domains tagged with 'staging' from hosts file
from_hosts staging {
reverse_proxy localhost:8080
}Example hosts file format:
app1.example.com staging
app2.example.com staging
api.example.com prod
The adapter will also check if the domains exist in the system's /etc/hosts file and generate warnings for any missing entries. Useful for local developement.
xcaddy build --with github.com/tomrplummer/with-hosts./caddy run --config ./Caddyfile --adapter caddyfile_withhosts