Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance caddywaf with logging, caching, and more features #12

Merged
merged 6 commits into from
Jan 8, 2025

Conversation

fabriziosalmi
Copy link
Owner

This commit introduces several enhancements to the caddywaf package, including:

  • Improved Logging: Implemented configurable JSON logging and log file paths, providing detailed request information, and integrating context-based log IDs.
  • GeoIP Caching: Added a configurable GeoIP lookup cache to improve performance and reduce database load. Configurable TTL and a fallback behavior for lookup failures added.
  • Custom Block Responses: Implemented custom response bodies and headers for blocked requests.
  • Graceful Shutdown: Added a shutdown function that closes resources properly.
  • Configurable Fallback: Implemented a configurable fallback for geoIP lookup failures.
  • Configuration Reloading: Added file watching for rule files and blacklist files to trigger automatic reloading.
  • Code Refactoring: Improved error handling and readability throughout the code.
  • Targeted Extractions: Added more targeted extraction for headers, cookies, query parameters.
  • Log file path: Added log_path directive in Caddyfile and debug.json log

feat: Enhance caddywaf with logging, caching, and more features

This commit introduces several enhancements to the caddywaf package, including:

- **Improved Logging:** Implemented configurable JSON logging and log file paths, providing detailed request information, and integrating context-based log IDs.
- **GeoIP Caching:** Added a configurable GeoIP lookup cache to improve performance and reduce database load. Configurable TTL and a fallback behavior for lookup failures added.
- **Custom Block Responses:** Implemented custom response bodies and headers for blocked requests.
- **Graceful Shutdown:** Added a shutdown function that closes resources properly.
- **Configurable Fallback:** Implemented a configurable fallback for geoIP lookup failures.
- **Configuration Reloading:** Added file watching for rule files and blacklist files to trigger automatic reloading.
- **Code Refactoring:** Improved error handling and readability throughout the code.
- **Targeted Extractions**: Added more targeted extraction for headers, cookies, query parameters.
log_path added (default: DEBUG level to debug.json)
caddywaf.go Dismissed Show dismissed Hide dismissed
caddywaf.go Dismissed Show dismissed Hide dismissed
fsnotify
@fabriziosalmi fabriziosalmi merged commit 6a538e6 into main Jan 8, 2025
5 checks passed
@fabriziosalmi fabriziosalmi deleted the test branch January 8, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant