We have long recommended using Cloudflare to boost our customer’s site speed and enhance its security. While it’s not relevant to everyone, it is a useful tool to have in the arsenal to protect and improve your site’s performance.
What is Cloudflare?
Cloudflare have been around since 2009 and provide their services to around 25 million websites. At its most basic, Cloudflare is a content delivery network (CDN) which sits between your website and your visitors, providing a robust performance and security layer before visitors (or hackers) touch the server hosting your site – think of it as a bouncer on the door to your site.
It has two main benefits:
- Security: A WAF (Web Application Firewall) security component protects your website against network level attacks, malicious bots, hackers, and other nefarious entities.
- Site Performance: components use caching to boost page load times, meaning that the loading of images and pages can bypass the original web server. This means that should the site’s server go offline, your site will not necessarily become unavailable (content that is uniquely generated per viewer cannot be cached in this way).
How does it work?
Normally, when a user types www.example.com it is translated to an IP address and sent to our server, and the server responds with the components for the page you’ve requested.
For a Cloudflare site, you type a domain name and connect to the closest server in Cloudflare’s network of over 250 cities. They will then validate your request against various rules so as to recognize and reject nefarious hack attempts such as SQL injection, known bad bots, and content spam. Because Cloudflare covers millions of sites across the world, they analyse over 20 million requests per second to detect dodgy activity and common attacks, stopping them before they get to your site. This scale allows them to witness behaviour across their entire network and often block new classes of attack (aka Zero-Days) before the patches are even available.
As well as this, Cloudflare ‘caches’ your site, creating a copy on their servers that are distributed around the world, and ensuring greater loading speed. For instance, when a new user visits your site from, say, Sydney in eastern Australia, Cloudflare will have it delivered from our server in the UK. However, when a 2nd viewer in Sydney makes the same request soon after, they will see the copy that’s already stored on Cloudflare’s server in Sydney, thus significantly speeding up the page load. It’s even possible for a viewer from Melbourne, western Australia, to hit their local server and also benefit from that first Sydney viewer, due to regional caching.
Cloudflare offers the benefits of having access to servers located within China which, subject to certain conditions, can be used to provide access to the Chinese markets, which are often otherwise restricted by their government’s tight control of internet access.
Other benefits of caching include the ability to deliver automatically optimised versions of web images, and compress dynamic content, further speeding up delivery time. This can be used to keep hosting costs down. It is also especially useful for sites that need to scale up and down with peaks of traffic (such as during newsletter delivery) but are comparatively quiet the rest of the time.
The customisation options for your Cloudflare use are really almost limitless, as they have access to a range of rules, and, for more complex requirements, code that is implemented at their regional servers.
Cloudflare in Action
Infotex’s technical understanding and experience of working with Cloudflare allows us to utilise their unparalleled capabilities to the full. The following offer some examples of how Cloudflare has helped our clients over recent years.
We have seen and dealt first-hand with our ecommerce customers being sent ransom requests for thousands of pounds with a threat of taking their site offline. When these requests are (rightly) ignored by our client, their sites are subjected to a huge DDoS attack, where thousands of requests are sent every second, which would often overload the server and take the site offline (and any other sites on that server). Our solution to these attacks has been to migrate the domain over to a server with Cloudflare protection, which has built-in DDoS protection. This way, while the attack continues, Cloudflare’s protection can shrug it off and enable trading to continue as normal.
Attacks from Abroad
Cloudflare has protected some of our clients with high levels of attack traffic originating from countries such as China and Russia, which are not countries they manage their websites from, thus allowing admin, or all requests, from these countries to be blocked by Cloudflare or subject to more stringent validation; in either case the viewer would be met with a fully branded page explaining why their request was declined without ever risking the request touching our original server.
Dealing with Traffic Spikes: Going Viral
One client needed help scaling their WordPress-powered sites to handle their stories going viral, but that would operate at a low cost in-between high demand. By utilising Cloudflare’s ability to cache full page contents and use tiered regional caches we have been able to create a site that updates the latest content in a timely manner, while achieving a 95+% cache rate on the terabytes of data the site drives. By letting Cloudflare do most of the heavy lifting it keeps their hosting costs lower than having servers that could deal with the demand.
Coping with a Newsletter Audience
For people sending newsletters there are often unique tracking parameters on website links, meaning that traditional caching would not work. In some cases Cloudflare enabled us to develop code that could run in Cloudflare’s servers to identify these separate parameters, and so we were able to increase newsletter viewership from around a 10% cache rate to over 90%, thus massively reducing the traffic spikes these newsletters cause. In less technical language, it made the pages load quicker and improved the customer experience.
If you’re an existing Infotex customer get in touch about how Cloudflare could help protect your online investment.