caddy add-package
github.com/fabriziosalmi/caddy-waf is registered in Caddy's package registry (since 2026-07-28), so it can be added to an existing Caddy binary without a Go toolchain. It is also selectable on https://caddyserver.com/download.
For registration status and history see CADDY_MODULE_REGISTRATION.md.
Requirements
- Caddy v2.7 or newer (
add-packagewas introduced in 2.7). - Network access from the Caddy host to
caddyserver.com. - Permission to replace the running Caddy binary.
Install
caddy add-package github.com/fabriziosalmi/caddy-wafThis will:
- Detect the currently running Caddy and its module set.
- Send a build request to the Caddy build service.
- Download a new binary containing the existing modules plus
caddy-waf. - Back up the current binary (deleted unless
--keep-backupis passed). - Replace the Caddy binary in place.
Verify:
caddy list-modules | grep waf
# expect: http.handlers.wafPin a version
caddy add-package github.com/fabriziosalmi/caddy-waf@v0.4.19Any tag from the Releases page works. Without a version the build service uses the latest tag.
Note that v0.3.3 and earlier carry a high-severity denial-of-service (GHSA-gfj3-cmff-q8wh), fixed in v0.3.4; do not pin below v0.3.4.
Remove
caddy remove-package github.com/fabriziosalmi/caddy-wafWhen to build with xcaddy instead
add-package replaces a binary in place using a remote build service. Prefer xcaddy when you need to build from a fork or an untagged commit, pin the Caddy version itself, build in an air-gapped environment, or produce reproducible artifacts in CI:
xcaddy build --with github.com/fabriziosalmi/caddy-wafSee Build Caddy with plugins for pinning, several plugins and Docker.
Caddy's maintainers are discussing whether to move add-package, remove-package and upgrade out of Caddy's core (caddyserver/caddy#7010, open since May 2025). The commands still ship in Caddy 2.11 and rely on Caddy's shared build server, so use xcaddy or Docker for anything you deploy or automate.
Troubleshooting
command not found: caddy add-package
You are running Caddy older than 2.7. Update Caddy.
permission denied
The new binary cannot replace the existing one. Re-run with sudo, or run add-package from a directory the user can write to and move the resulting binary into place manually.
Error: download failed: HTTP 400: ... is not a registered Caddy module package path
Check the import path for typos. Go module paths are not URLs, so no https:// prefix and no trailing slash. If the path is correct and the error persists, the registration may have been removed — see CADDY_MODULE_REGISTRATION.md.
References
- Caddy command line: https://caddyserver.com/docs/command-line
- Extending Caddy: https://caddyserver.com/docs/extending-caddy
xcaddy: https://github.com/caddyserver/xcaddy