Caddy Header Verification is a Caddy addon designed to detect bots and potentially malicious clients by inspecting and validating incoming HTTP headers. It helps identify unusual, malformed, or manipulated headers commonly associated with automated or abusive traffic.
- Detects malformed or suspicious HTTP headers
- Helps identify bot or automated traffic
- Integrates as a Caddy middleware
- Includes unit tests for header verification logic
This module must be compiled into a custom Caddy binary.
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latestxcaddy build --with github.com/IgnifexLabs/CaddyHeaderVerificationThis produces a custom Caddy binary that includes the header verification middleware.
Enable the middleware in your Caddyfile for the sites or routes you want to protect It is important to change the order in the caddy File. for chromium based applications the client hints are a valuable item and should be integrated.
{
order headerchecker before respond
}
:8080 {
header {
Accept-CH "Sec-CH-Device-Memory, Sec-CH-DPR, Sec-CH-Prefers-Color-Scheme, Sec-CH-Prefers-Reduced-Motion, Sec-CH-Prefers-Reduced-Transparency, Sec-CH-UA, Sec-CH-UA-Arch, Sec-CH-UA-Bitness, Sec-CH-UA-Form-Factors, Sec-CH-UA-Full-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-WoW64, Sec-CH-Viewport-Height, Sec-CH-Viewport-Width, Sec-CH-Width"
Critical-CH "Sec-CH-Device-Memory, Sec-CH-DPR,Sec-CH-UA, Sec-CH-UA-Arch,Sec-CH-UA-Bitness,Sec-CH-UA-Full-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version, Sec-CH-UA-WoW64, Sec-CH-Viewport-Height, Sec-CH-Viewport-Width, Sec-CH-Width"
}
headerchecker
respond "OK"
}
Unit tests are included for validating header detection logic.
Contributions are welcome!
Fork the repository
Create a feature or bugfix branch
Submit a pull request with a clear description
Please include tests for new functionality where possible.
This project is licensed under the GNU General Public License v3.0. See the LICENSE