How to block sites such as checkip.amazonaws.com [closed]

I'd like to find a way to block websites like https://checkip.amazonaws.com or at least restrict them to the point they can no longer output my server's public IP address.

For example, if I do curl https://checkip.amazonaws.com my output would simply be 1.1.1.1 (or in other words, my IP address).

Is there a way to have an app that would inspect the output of each website my server tries to connect to and if the output contains a specific string, it automatically blocks it?

I know a way to block them one by one, but is it possible to block all similar websites based on their output?

But why?!

The reason is simple. There are people hosting game servers on a dedicated server. However, with extensions to those servers, people can easily find the public IP of the machine they are on. The public IP is hidden via reverse proxy for network protection. If a user finds the real IP of a machine, they can use it to perform an attack or do other malicious activities.

Thanks!


Don't bother, you are fighting against windmills. This is just one of an endless list of services that show your IP address, you will never be able to block them all.

And even if you could, the user could just run his own anywhere he wants.

Restricting outgoing IP connections would be more useful, if that doesn't disrupt your services.