Skip to content

tomrplummer/with-hosts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caddy With-Hosts Adapter

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.

Caddy File Syntax

@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.

Installation

xcaddy build --with github.com/tomrplummer/with-hosts

Usage

./caddy run --config ./Caddyfile --adapter caddyfile_withhosts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages