Is it possible to serve specific pages based on IP address?

Just install fail2ban with the appropriate jail and be done with it. Don't bother to give a custom response, as it's most likely that it will never be seen.


There is a possibility, and we did it quite a lot, to reverse possible attacks. Use iptables to redirect the cloud provider (address range) to a different port - and there serve the attacker a response, even in plain headers.

In Apache you can modify headers by example:

Header set GetOut "Better luck next time!"

This is very easy with ModSecurity which is a third-party WAF module for Apache. Though it does involve learning its rule language syntax.

You can also use ModSecurity to just drop the connection rather than respond at all.

Saying that, installing ModSecurity just for this, when, as others have suggested, it's likely the responses will be ignored may well be overkill.