У меня есть сервер Apache на ubuntu, и иногда в нем много требований. /var/log/apache2/access.log
как это:
115.231.218.252 - - [04/Dec/2017:08:35:38 -0500] "CONNECT www.alipay.com:443 HTTP/1.1" 403 451 "-" "Go 1.1 package http"
118.123.12.179 - - [04/Dec/2017:08:36:08 -0500] "GET http://www.search.com/?rnd=_72367536011469122613864 HTTP/1.1" 403 450 "-" "-"
Таких запросов было много, и я отфильтровал их через белый список IP-адресов, которые могут получить доступ к моему серверу, но мне это решение не нравится.
Правильный запрос на мою услугу выглядит так:
95.79.59.202 - - [04/Dec/2017:08:34:43 -0500] "GET /js/comments.js?1461239263 HTTP/1.1" 200 2563 "data" "Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0"
Правильные запросы никогда не начинаются с http
modproxy отключен, и мне не нужно иметь прокси на этом сайте ни в какой форме. Есть ли способ отключить все запросы http
ресурс, а не только местный?
Загруженные модули:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgid_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
expires_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
perl_module (shared)
rewrite_module (shared)
security2_module (shared)
setenvif_module (shared)
status_module (shared)
unique_id_module (shared)
Вы можете условно заблокировать запросы, используя мод переписать.
Например, следующее будет блокировать запросы GET и POST, где запрошенный URI начинается с http: // или https: //
RewriteEngine On
RewriteCond %{THE_REQUEST} "^(GET|POST) https?://"
RewriteRule ^ - [F]