All about CloudFlare:

I, Arslan Mirbzergi,in this article about CloudFlare and their key role in improving the speed and security of sites, I intend to provide you with information about CloudFlare and their key role in improving the speed and security of sites. Let’s start the article by talking about CDN.

What is CDN?

CDN or Delivery Network Content is a system for controlling site usage from server resources. It also prevents website data from security attacks. DNS on CDN also speeds up site loading. This will be effective in increasing users’ satisfaction with your site. CDN is actually one of the most popular types of CloudFlare. This system increases site speed by reducing bandwidth consumption. On the other hand, it blocks all spammers entering your site and in this way, it greatly reduces the threats to your site.

Sometimes the host associated with your site may be located in another country, and being away from the distance may cause a slowdown. In this case, CloudFlare keeps cached versions of your site in datacenters in closer areas and your site is loaded through these datacenters and faster than when you need access to the main server.
In this method, THE CDN keeps fixed information such as images in closer datacenters and calls variable information such as HTML code from the main server. This will reduce the server bandwidth consumption and increase the loading speed of the site.

CloudFlare datacenters:

In the image above, received from the CloudFlare site, you will see the traffic route of websites through the CloudFlare network. The network contains 34 data centers around the world. All Iranian users using U.S. hosts can use CloudFlare to increase their site speed and reduce bandwidth consumption.

How does CloudFlare prevent spammer attacks?

We said that CloudFlare can prevent spammers from entering your site. But you might be wondering how this is going to work? CloudFlare sits like a protective barrier between the main server and the site. Also, using CloudFlare, DNS and IP of your main server will be hidden from hackers. This is done through CloudFlare’s built-in Firewall. In contrast, in case you don’t use CloudFlare on your site, site and server IP information will be easily shared with hackers through tricks such as DDOS attacks. In the following image, you will see an example of an attack operation on the target server via unsafe DNS.

In the next section, the CloudFlare system is located on the server. In this case, after detecting an unsafe DNS attack, these DNS’s are immediately blocked and the server attack process is prevented from continuing.

What are the advantages of using CloudFlare?

Using CloudFlare also has the advantages that we mention below.
• Connect to the nearest server to load the site and provide content via CDN activation
• 24-hour site enabled through caches on CloudFlare server
• Site optimization by reducing bandwidth
• Increase site speed by compressing Java Script, CSS and HTML codes
• Enhance site security by repelling DDOS protection and Injection SQL attacks and preventing spam-containing requests from entering the site
• Having a traffic analysis system in order to better manage site traffic and visits
• Refresh caches via Cache Pruge

How to enable CloudFlare?

To activate, follow the steps below:

1 . First, login to the   official CloudFlare site.
2 . Click on up Sign to create a new account.

3 . On the page that opens, enter the email address and password you want, and finally tick the option to confirm the rules and click Create Account.

4 . After creating the account and signing in to it, from the Add a Website section, enter the name of the site you want, and then click records scan DNS.

5 . After checking your site’s DNS records, which takes about 1 minute, click Continue.

6 . In the next section, a list of all DNS records of your site’s domain, including Subdomains (subdomains) will be displayed. If you need to create a new history, you can do so by clicking Record Add.

All available records are usually displayed automatically. If the records are not displayed to you, you can create them in person. In that case, you need to enter the IP of your site as well. You can also specify at this point which CloudFlare is active or inactive on which Subdomain and DNS history (this is determined by the presence of grey and orange clouds, which orange means active and gray means inactive.) May this action change by clicking on these clouds. At this point, note that CloudFlare does not build on records like MX, and this record is usually cloudless.

7 . In the next step, you need to specify the type of plan you want. Usually, cloudFlare’s varied and plentiful free plan is enough for you, but you can also use other costly plans if you wish. To select cloudFlare plan, select Free Plan and click Continue.

8 . Next, CloudFlare displays two new DNS on your site domain. You must set up DNS related to your site domain on DNS given by CloudFlare and delete previous DNS.

For internal domains, you should do this by logging in to the http://www.nic.ir site or the first-order domain registration center of Iran. For international domains, this is also done through the domain regent’s user area (e.g. by changing Host control or domain DNS). Note that it usually takes 24 to 72 hours to apply changes and set up DNS completely on CloudFlare. After this step is finished, click Continue. After going through these steps, you will be taken to the main page of the site. In this case, your site’s status is in pending or pending mode and must be timed to make changes. At this point, you can find out the status of DNS by clicking on Nameservers Recheck.

After the timeframe ends and changes are made to the site, the status of the site will be active.

To compare changes in site loading speed, you can enter your domain on one of the gtmetrix or pingdom sites before activating CloudFlare on it, and write down its loading speed and use it for comparison in CloudFlare activation mode.

After activating CloudFlare, you can also check your site loading speed again through these 2 sites. (In this example, the speed has decreased from second to millisecond. )

Practical Tips:

Check site status via Analytics

In your account, sign in to Analytics.

In this section, you can see the amount of requests to log in to your site along with the diagrams related to it.

In the Performance section, you can also see how much you don’t need to go to the main server due to the use of servers Cache, bandwidth savings, types of site content, total threats stopped against the site, the amount of incoming traffic via SSL that includes secure and unsafe requests, and finally the amount of reduced threats.

You can also see statistics on the number of requests from different countries’ IP and different search engines.

You can also compress HTML, CSS and JavaScript files in analytics and speed headers. To do this, enable the HTML, CSS and JavaScript options from the Minify Auto section.

If you want to make quick changes to the cache on CloudFlare through the Caching section and the Cache Purge section, do so.

The Purge Individual File is used to reflux a specific part of the site.

The Purge Everything section is used to reflux the entire site.

How to use Firewall in CloudFlare?

For this purpose, log in to the Firewall section in your account.

This tool allows you to define new security rolls for the site. Through this section you can find activities such as defining authorized and unauthorized IPs to access the site and … To define. Note that only the Firewall IP section can be used in the free CloudFlare plan, and the Firewall Application Web section is available in the professional plan. DDOS Protection features are also available on the Business Plan. With this account, you should use cloudFlare purchaseable accounts if you need advanced features. You can also disconnect unauthorized access to your site using the Firewall IP section. This section can be adjusted differently according to the security requirements you need.

We emphasize that without sufficient information, avoid settings that you do not trust.

Determining the site review time period for refreshing caches

The timeframe for reviewing your site by CloudFlare can be changed by you and you can consider any desired timeframe for this. We recommend that you do not throw a short distance between these timeframes. To do this, log in to the Caching section from your account and select the timeframe from the Expiration Cache Browser section.

And in the end,

In this article, you are familiar with the concept of CDN and CloudFlare and how to create CloudFlare on the site. We also explained some of the necessary settings and how to work with this system. You can also use CloudFlare tools from apps. Some of the state-of-the-art facilities are also related to CloudFlare’s purchaseable plans, and you can access these facilities after purchasing these plans.