Open MyLifeOrganized opened 5 months ago
Can confirm same behaviour on Apache 2.4.6 @ CentOS 7.9
It seems that the variable "good_bot," which was set using "BrowserMatchNoCase," cannot simply be overwritten again with "BrowserMatchNoCase."
I was able to solve this by removing the "good_bot" variable with SetEnvIfNoCase User-Agent "\b$BOTNAME\b" !good_bot and then resetting it with BrowserMatchNoCase "\b$BOTNAME\b" bad_bot.
Here is an example from my blacklist-user-agents.conf with the YandexBot:
# Removing the "good_bot" flag and setting the "bad_bot" flag.
# -----------------------------
SetEnvIfNoCase User-Agent "\bYandexBot\b" !good_bot
BrowserMatchNoCase "\bYandexBot\b" bad_bot
# -----------------------------
I want to block an User-Agent which is listed as "good" in globalblacklist.conf
However when I add it to blacklist-user-agents.conf it is not blocked. Steps to reproduce:
(Applebot is a "good bot" in globalblacklist.conf)
Restart apache
Try:
Expected: 403 Forbidden
Actually: The HTML page is returned normally
I am using version Apache_2.4
I also tried this syntax and it did not work as well BrowserMatchNoCase "(?:\b)Applebot(?:\b)" bad_bot
If I block other User-Agents not white-listed in globalblacklist.conf it works as expected and blocked
Your documentation in blacklist-user-agents.conf says:
I see that actually blacklist-user-agents.conf is included after, not before white listing in globalblacklist.conf I've also tried to change globalblacklist.conf and include blacklist-user-agents.conf first and it still does not work.
How do I block an User-Agent white-listed in globalblacklist.conf?
Server :