mirror of
https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker.git
synced 2025-09-01 18:19:55 +00:00
do not add includes for redirect vhosts
* adds a condition to only insert includes if a vhost file contains a root directive (to ignore vhosts which are simply redirects) * fixes https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/issues/138
This commit is contained in:
parent
f9e152b7f9
commit
21830c19b6
1 changed files with 6 additions and 2 deletions
|
@ -390,10 +390,14 @@ main() {
|
|||
# update vhosts
|
||||
for file in $file_list; do
|
||||
line=$(find_includes $file include last server_ last location first )
|
||||
|
||||
if [ -n "$(check_wildcard $file $BOTS_DIR)" ]; then
|
||||
# do not use wildcards in vhost files
|
||||
printf "%-10s %-${col_size}s %s\n" "WARN:" "$BOTS_DIR/* detected" "=> $file"
|
||||
else # don't use wildcards in vhost files
|
||||
add_includes $line $file $BOTS_DIR $col_size $VHOST_INCLUDES
|
||||
else # do not add includes to vhosts without root directive (i.e redirects)
|
||||
if grep -Ew [[:space:]]+root $file 1>/dev/null; then
|
||||
add_includes $line $file $BOTS_DIR $col_size $VHOST_INCLUDES
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue