Skip to content

Commit

Permalink
Block bad boots
Browse files Browse the repository at this point in the history
  • Loading branch information
laukstein committed Nov 30, 2015
1 parent 69c6d27 commit 70839b9
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ~config/httpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,14 @@ DirectorySlash Off
# OPTIONS method is used by CORS https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
#
Require method GET POST
# <LimitExcept GET POST>
# Require all denied
# </LimitExcept>

# Block bad boots https://xuri.me/2015/03/18/anti-bad-bots-and-crawlers-by-user-agent.html
SetEnvIfNoCase User-Agent ".*(^$|Indy Library|Alexa Toolbar|ZmEu|HttpClient|Ezooms)" bad_bot

<RequireAll>
Require all granted
Require not env bad_bot
</RequireAll>

# Enable rewrite_module
<IfModule rewrite_module>
Expand Down Expand Up @@ -93,12 +98,12 @@ TraceEnable off
<IfModule log_config_module>
<IfModule setenvif_module>
# Do not log localhost
SetEnvIf Remote_Addr 127\.0\.0\.1 nolog
# SetEnvIf Remote_Addr ::1 nolog
SetEnvIf Remote_Addr "127.0.0.1" dontlog
# SetEnvIf Remote_Addr "::1" dontlog
# Do not log various assets
SetEnvIf Request_URI \.(appcache|crx|css|eot|gif|ico|jpe?g|js|mp4|oga|ogg|ogv|otf|pdf|png|svg|ttf|txt|vcard|vcf|nex|webapp|webm|webmanifest|webp|woff|woff2|xml|xsl)$ nolog
SetEnvIf Request_URI \.(appcache|crx|css|eot|gif|ico|jpe?g|js|mp4|oga|ogg|ogv|otf|pdf|png|svg|ttf|txt|vcard|vcf|nex|webapp|webm|webmanifest|webp|woff|woff2|xml|xsl)$ dontlog
</IfModule>
CustomLog "logs/access_log" combined env=!nolog
CustomLog "logs/access_log" combined env=!dontlog
</IfModule>

<IfModule mime_module>
Expand Down

0 comments on commit 70839b9

Please sign in to comment.