23 lines
595 B
PHP
23 lines
595 B
PHP
<?php
|
|
|
|
class HeadRequestRule implements RuleInterface
|
|
{
|
|
public function execute()
|
|
{
|
|
$ip = BotLogger::getRealIp();
|
|
if (BotLogger::isWhitelisted($ip)) {
|
|
return true;
|
|
}
|
|
// Detect HEAD request with Filter parameters
|
|
if ($_SERVER['REQUEST_METHOD'] === 'HEAD' && (Tools::getIsset('q') || Tools::getIsset('order'))) {
|
|
|
|
// Log for Fail2Ban
|
|
BotLogger::logBan($ip, 'HEAD_REQUEST_SPAM');
|
|
|
|
header('HTTP/1.1 405 Method Not Allowed');
|
|
die('Method Not Allowed');
|
|
}
|
|
return true;
|
|
}
|
|
}
|