How to stop unnecessery requests to my app?

Posted October 14, 2018 663 views
ApplicationsUbuntu 18.04

I developed locally a very simple app, which takes webhooks from and sends messages to a Discord server. Few months ago, this app was written in php and hosted on a shared hosting provider. But recently I decided to redo it, this time in node.js and host it on DO.
So before, on the shared hosting account I could see logs of all my visitors. And they would be exactly what I expect - only a few requests per day, coming from a twitch IP and sometimes google bots. On this new node.js app, I implemented morgan logging and as soon as the app started running, my logs started filling with http requests from China. Multiple requests every hour. It basically defeats the purpose of my app having a logging feature. And I really would have liked it to be able to browse my logs to see in detail what info is passing through my app.
So, what are my options here? Should I use some kind of IP blocker? (I am student and would like to use a free solution)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi @ambedorn,

The difference is that on the Shared Server there were already security in place.

I’ll recommend installing a firewall and configure it to block requests from an IP if it’s not in the allow list and exceeds the configured limits.

A good tool like that one would be Fail2Ban or just plain old CSF. Both have a configuration file that would allow you to block traffic from certain countries or just limit the number of requests.