adds caddy-addon mechanism for custom certificates when let's encrypt is not available. includes setup script with interactive wizard, example configs, and documentation.
Caddy Addons
This directory allows you to extend or override Caddy configuration without modifying the main Caddyfile.
All .conf files in this directory are automatically imported via import /etc/caddy/addons/*.conf at the end of the main Caddyfile.
Use Cases
- Custom TLS certificates (corporate/internal CA)
- Additional reverse proxy rules
- Custom headers or middleware
- Rate limiting or access control
Custom TLS Certificates
For corporate/internal deployments where Let's Encrypt is not available, you can use your own certificates.
Quick Setup
-
Place your certificates in the
certs/directory:cp /path/to/your/cert.crt ./certs/wildcard.crt cp /path/to/your/key.key ./certs/wildcard.key -
Run the setup script:
make setup-tls -
Restart Caddy:
docker compose -p localai restart caddy
Manual Setup
-
Copy the example file:
cp caddy-addon/custom-tls.conf.example caddy-addon/custom-tls.conf -
Edit
custom-tls.confwith your hostnames and certificate paths -
Place certificates in
certs/directory -
Restart Caddy:
docker compose -p localai restart caddy
How Site Override Works
When you define a site block in an addon file with the same hostname as the main Caddyfile, Caddy will use both configurations. To completely override a site, use the exact same hostname.
Example: To override n8n.yourdomain.com with a custom certificate:
# caddy-addon/custom-tls.conf
n8n.internal.company.com {
tls /etc/caddy/certs/wildcard.crt /etc/caddy/certs/wildcard.key
reverse_proxy n8n:5678
}
Make sure your .env file has N8N_HOSTNAME=n8n.internal.company.com.
File Structure
caddy-addon/
├── .gitkeep # Keeps directory in git
├── README.md # This file
├── custom-tls.conf.example # Example for custom certificates
└── custom-tls.conf # Your custom config (gitignored)
certs/
├── .gitkeep # Keeps directory in git
├── wildcard.crt # Your certificate (gitignored)
└── wildcard.key # Your private key (gitignored)
Important Notes
- Files in
caddy-addon/*.confare gitignored (preserved during updates) - Files in
certs/are gitignored (certificates are not committed) - Example files (
*.example) are tracked in git - Caddy validates configuration on startup - check logs if it fails:
docker compose -p localai logs caddy