Block IPs that are DDoS'ing our website

  • Site name: fluid-fluidproject-org

We’re getting inundated with requests from Chinese IPs requesting a lot of pages from our website. As far as I can see from our Matomo analytics, it’s all for nonexistent pages.

This is causing our bandwidth usage to skyrocket and we’re worried about it.

How could we block this with Netlify?

Hi there, @gtirloni :wave:

Thank you so much for reaching out and sharing this concern. I have opened a Helpdesk ticket for you so that you can work directly with a Support Engineer to address this. Stay tuned to your email for next steps.

1 Like

Hey Giovanni,

The easiest way to tackle this is with our country-based redirects. If you’re experiencing issues with users from China, you can redirect visitors from this country wherever you like – including to a 0 bytes page (to not impact your bandwidth usage) or off-site (say, to Google).

In a _redirects file, you can add the following line:

/* https://google.com 302! Country=cn

or

/* /blank 302! Country=cn

/* means all pages, the next part is a URL to send them to (you may want to upload a blank file to blank.html if you want to keep them on-site), 302 implies this is temporary, the ! forces the redirect (without the force, visitors would only be redirected if the page on your site doesn’t exist. So, for your dilemma, you may want to use 302 and not 302! ) and then, the country is self-explanatory and uses international country codes.

I hope that this helps! Alternative solutions would/could involve a Netlify function but this will require a lot more engineering from you.

1 Like