Boost your website for free with Cloudflare

Although Cloudflare is one of the most popular and performant CDN on the market, it’s not necessarily overpriced. I mean, you can benefit even from the free plan they offer.

Content Delivery Network

Before exploring the solution itself, let’s talk briefly about CDN again. A Content Delivery Network, or CDN, is meant to be between your web server, and the client (for instance a Chrome web browser on an Android phone). Remember that it’s not a single machine, but a whole network of several physical instances spread across the globe, thus for serving it’s main purpose: reduce latency. One fact about latency: part of it is due to the distance a packet has to travel between point A and point B, so if you want a packet to be delivered faster, just make it closer!

Cloudflare Points of Presence (POPs) across the globe

There are numerous extra benefits that come with the setup of a CDN, including other performances optimizations and security features, I will cover some of them in this article.

Why you may need a CDN

If you read this article, you are probably the owner of a freshly developed or built website. Regardless of it’s purpose or manufacturing process, you want it to be fast, and of course, available.

It speeds up your pages and medias

As mentioned above, latency is reduced by decreasing the physical distance between the server and the clients. But there is also a latency that is coming from the preparation of your content: resizing the images, execute your PHP scripts, compute translations, and so on. But now, what is the point to resize multiple times the same image when the result is the same for all users? Also, this takes time, whereas have it in a storage ready would be much faster. CDNs also come with some optimizations like compression, or minification.

It reduce your server load

Your server, also called origin in an architecture with a CDN, is responsible for a lot of tasks we discussed at the end of the previous paragraph. When the traffic is a bit higher than usually, the CPU or RAM load can increase, even sometimes it can result in an overload. With a CDN, many of those tasks are not necessary since the produced assets or pages are already store on the network.

It provides a strong barrier against attacks

First of all, because your domain will be linked to the CDN and not directly to your server, the latter will have no IP directly exposed. It means unless someone knows your IP from another source, your origin is less prompt to receive malicious traffic directly. Instead, the attacker may target your CDN, which is well protected against this type of threat. DDoS attack protection is included in the free plan of Cloudflare for example, and it’s unlimited.

SSL certificates for free

And most of their installation process is automatic. No need to setup a certbot for example. Also, the certificates are valid longer than the well-known Let’s Encrypt 90 days free certificates.

The Cloudflare free plan


The setup is pretty simple. You just type in a domain name, and the wizard will guide you through easy steps. First identify your registar, or basically the provider where you bought your domain from, then modify the NS (or NameServer) records using your provider’s web interface, and finally indicate A and AAAA records which lead to your origin.

By default, your A and AAAA records will be show as Proxied. It means CDN can work and all features can apply to this origin.

And there you go, you have got a basic infrastructure with a CDN between your clients and your origin!

Basic configuration

Cache: At this stage, Cloudflare will apply a default cache strategy where most of your front pages will not be cached, and the assets will likely be cached, automatically. However, feel free to check in the Caching > Configuration and Caching > Cache rules tabs, you may be able to create wise rules for the caching strategy based on what your website needs. Don’t worry, if you end up caching to aggressively and you get outdated data, there is purge options, to remove some or the entirety of the cached files. Also, if you just want to temporarily disable the cache, check out Development Mode.

SSL/TLS: By default, this is in Flexible mode, meaning that the traffic is encrypted between the browser and Cloudflare, whereas the one between Cloudflare and your origin is not. You may consider it as sufficient, or update to Full or Full (strict) mode.

Nice features

You can use HTTP/3 between the CDN and the client’s browser! This feature can be enabled via Network > HTTP/3 (with QUIC). In simplified terms, this implementation will use UDP instead of TCP, improving the concurrency of streams mainly.

Also, feel free to check the Speed > Optimization tab. There is a section called Auto Minify. If your CSS, JS, or HTML files are not optimized, they may contain a ton of useless characters, like line-breaks, spaces… This is normally trimmed while building the application, but sometimes it not, or not optimized. Cloudflare is capable of doing this optimization even if your origin is serving non-minified files. The files size will reduce, and so will the transfer time.

You’re all set 🚀

At this point, your site should already benefits a lot from the solution, and without paying any extra dollar for it. Of course, Cloudflare is an awesome network with brilliant optimizations, settings and gadgets, so paying for a higher plan could be a great investment. Now you’ve got time to play with your CDN, explore competition solutions, and get fully ready for your next level infrastructure.

Leave any comment if you like, especially if you have suggestion or if you liked this content.

Related Posts

Test your Apache configs and .htaccess locally

Let’s be honest, modifying Apache configurations or .htaccess is always scary on a remote server, especially if you expect some traffic to reach your website. And testing…

Leave a Reply

Your email address will not be published. Required fields are marked *