Caddy Reverse Proxy Stack#
This stack provides a Caddy HTTPS reverse proxy for homelab services, using internal domains and subdomains for routing.
Usage#
-
Set the
PODS_HOMEenvironment variable to your pod home directory (e.g.,/path/to/pods). -
Add entries for all stacks to your client machine's hosts file. You can automate this with:
just prep-homelab [IP]This will scan all stacks and add lines like:
127.0.0.1 dockge.homelab.internal(Replace
[IP]with your server's IP if not running locally; defaults to 127.0.0.1.) -
Create the external Docker network (required for all stacks):
docker network create homelab -
Build and start the Caddy stack:
export PODS_HOME=/path/to/pods docker-compose -f stacks/caddy/compose.yml build docker-compose -f stacks/caddy/compose.yml up -dWhenever you change the Caddyfile, re-run the build command above.
-
Ensure the dockge stack is running and accessible as
dockge:5001from the Caddy container (use Docker networking). -
Visit https://dockge.homelab.internal in your browser (accept the internal CA if prompted).
Trusting and Untrusting the Caddy Root CA#
To enable trusted HTTPS for all .homelab.local domains, you must trust the Caddy root CA on your system. This is fully automated:
-
Trust the CA:
just trust-caThis adds the Caddy root CA to your system trust store (macOS or Linux). You may need to enter your password for system changes.
-
Untrust the CA:
just untrust-caThis safely removes the Caddy root CA from your system trust store (using
ripfor safe file removal on Linux). The script prints the CA subject and fingerprint for manual removal if needed.
Troubleshooting:
- If your browser still trusts the CA after running
untrust-ca, check for duplicate CA entries in your user keychain (macOS Login), browser-specific CA store (e.g., Firefox), or manual imports. Remove all instances to fully untrust. - After trusting or untrusting, fully quit and restart your browser to clear any cached trust.
Configuration#
- The Caddyfile is version-controlled in this directory and copied into the image at build time (see Dockerfile).
- Caddy data and config are persisted in
${PODS_HOME}/caddy/dataand${PODS_HOME}/caddy/config. - To add more stacks, edit the Caddyfile in this directory and rebuild the image with
docker-compose build. - No need to mount the Caddyfile from outside the repo.
Example Caddyfile#
dockge.homelab.internal {
reverse_proxy dockge:5001
tls internal
}