Mitigating DDoS attacks with CloudFlare

DDoS attacks are no joke. They are serious threats to the security of your data and the integrity of your business. Preventing them, as you may know, is no easy task. It presupposes constant care for your security, meaning that you should protect your precious data by all means possible. A common effective method is regular backup. Mitigating these attacks, on the other hand, can be done in a large number of ways.

A simple yet extremely efficient method is CloudFlare. CloudFlare is a US-based company that provides content delivery network (CDN) and distributed DNS services. Among other things, CloudFlare can help you mitigate DDoS attacks by enabling the “I’m under attack” mode. This tutorial will assist you in setting up CloudFlare so that it can protect you against such attacks.

Before starting the configuration process, you’ll need: a web server, a registered domain for that server, access to the control panel of the domain registrar and finally, a CloudFlare account. Once you have all of those, you can get started.

Configuring your domain

  1. You must first must configure your domain to use CloudFlare’s DNS. To do that, log in to CloudFlare and head to the Get Started with CloudFlare page. Here, you’ll have to add your website and click Begin Scan:

  1. The next page you’re taken to shows the results of scan. Make sure that all of your existing DNS records are present, as they are the records that CloudFlare will use to resolve requests to your domain.
  2. Next, you will be prompted to select a CloudFlare plan. In this case, it’s recommended that you choose the the free plan option.
  3. In the next page, you’ll find a table of your domain’s current nameservers and what they should be changed to. For the purpose of this tutorial, two of them should be changed to CloudFlare nameservers, and the remaining entries should be removed.
  4. Once you are done with that, click the Continue button. Note that It can take up to 24 hours for the nameservers to change but it usually only takes several minutes. The Pending status means that CloudFlare is waiting for the nameservers to update to the ones that it prescribed. All you can do now is wait. When the process is finished, the status will change to Active.


Enabling the ‘I’m under attack’ mode

By default, CloudFlare’s firewall offers a medium level of protection against visitors who are rated as a moderate threat by showing them a challenge page before allowing them to continue to your site. In the case of a DDoS attack, this degree of protection is insufficient, which is why the ‘I’m under attack’ mode is so useful. By enabling this mode, you will make sure that any visitor to your website will be presented with an interstitial page that performs some browser checks for about 5 seconds before allowing them access.

To enable this mode, you must simply go to the CloudFlare Overview page and select it from the Quick Actions menu.


To disable it, click the Disable button, found on the same page. Then switch back to the security level you prefer. The default and generally recommended mode is medium.

Once that’s done, you’re finished configuring CloudFlare for protection against DDoS attacks. Congratulations!

Leave a Reply