Welkom bij Bandhosting.nl,
hosting en webdevelopment.

Block a specific POST request

Today I've received a notification from our VPS provider that one server was sending out spam. Turned out to be an old Joomla form that wasn't protected properly.

Since I don't manage the site myself, I've notified the customer to take action. In the meantime, I've added a rule at the top of the .htaccess file of the site to block the spam from being sent at all:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{THE_REQUEST} /index\.php\?option=com_contact\&view=contact\&id=1 [NC]
RewriteRule ^ - [F,L]

Make sure you place this at the very top of the .htaccess file.

The result is that every form submit, will result in a 403 error:

x.x.x.x - - [14/May/2020:17:00:25 +0200] "POST /index.php?option=com_contact&view=contact&id=1 HTTP/1.1" 403 1705 "-" "-"