diff --git a/apache/botcheck.conf b/apache/botcheck.conf index 3fccd28..d589770 100644 --- a/apache/botcheck.conf +++ b/apache/botcheck.conf @@ -44,6 +44,14 @@ RewriteCond ${lookup:addresses.net.list;%{REMOTE_ADDR}|NOT_FOUND} !=NOT_FOUND RewriteRule .* - [E=BOTCHECK:OK] + # Set environment variable for allow-listed IPs (X-Forwarded-For header) + RewriteCond %{ENV:BOTCHECK} !^OK$ + # Make sure X-Forwarded-For header is present and not empty to avoid unnecessary error: + # invalid input "addresses.net.list;": missing config or lookup value + RewriteCond %{HTTP:X-Forwarded-For} !^$ + RewriteCond ${lookup:addresses.net.list;%{HTTP:X-Forwarded-For}|NOT_FOUND} !=NOT_FOUND + RewriteRule .* - [E=BOTCHECK:OK] + # Set environment variable for allow-listed User-Agents RewriteCond %{ENV:BOTCHECK} !^OK$ RewriteCond ${lookup:useragents.ri.list;%{HTTP_USER_AGENT}|NOT_FOUND} !=NOT_FOUND