From 13712e01d9df4e7673cf4444aab94c4d1a87e14b Mon Sep 17 00:00:00 2001 From: fabriziosalmi Date: Wed, 30 Apr 2025 11:38:01 +0200 Subject: [PATCH] Bump WAF version to v0.0.5 and ensure proper module registration --- Caddyfile | 5 ++--- caddywaf.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Caddyfile b/Caddyfile index e022496..ab3da6a 100644 --- a/Caddyfile +++ b/Caddyfile @@ -4,7 +4,6 @@ } :8080 { - log { output stdout format console @@ -32,7 +31,7 @@ requests 100 window 10s cleanup_interval 5m - paths /ratelimited # List of individual regex patterns (example: paths ^/api/.*) + paths /ratelimited # List of individual regex patterns (example: paths ^/api/.*) match_all_paths false } @@ -56,7 +55,7 @@ # Match the waf metrics endpoint specifically and stop processing @wafmetrics path /waf_metrics handle @wafmetrics { - header Access-Control-Allow-Origin * # Allow requests from any origin (for development - see note below) + header Access-Control-Allow-Origin * # Allow requests from any origin (for development - see note below) header Access-Control-Allow-Methods "GET, OPTIONS" # Allow GET and OPTIONS methods header Access-Control-Allow-Headers "User-Agent, Content-Type, *" # Allow User-Agent and Content-Type headers # Do not respond here so it goes to the WAF plugin diff --git a/caddywaf.go b/caddywaf.go index bfdd55c..9b8cc29 100644 --- a/caddywaf.go +++ b/caddywaf.go @@ -30,12 +30,12 @@ var ( ) // Add or update the version constant as needed -const wafVersion = "v0.0.1" // update this value to the new release version when tagging +const wafVersion = "v0.0.5" // update this value to the new release version when tagging // ==================== Initialization and Setup ==================== func init() { - caddy.RegisterModule(&Middleware{}) // Changed from Middleware{} to &Middleware{} + caddy.RegisterModule(&Middleware{}) // Uncommented this line to properly register the module httpcaddyfile.RegisterHandlerDirective("waf", parseCaddyfile) }