People switch a CDN on expecting speed and get four different things at once. It is worth knowing which is which, because each one goes on and off separately, and because three of them always help while one of them breaks sites.
|
None of this is ours and none of it is switched on in your panel. We do not sell a CDN. Everything described here lives in the Cloudflare dashboard, in an account you open with them, and which options you get depends on the plan you hold there. How to switch it on is in Cloudflare: when it helps and how to switch it on.
|
1. Caching: the copy kept near the visitor
This is the main job. The CDN keeps copies of your files and serves them without asking the server. There is one distinction that changes everything and that almost nobody makes:
| What it is |
What happens by default |
| Static files |
Images, stylesheets, scripts, fonts, downloads. Cached without you asking for anything. |
| Pages (the HTML) |
Not cached by default. That needs a rule, and the rule should only be written once you know what to exclude. |
| Pages for signed-in people |
Never to be cached. Cart, account, checkout, admin dashboard. |
This is why some people switch a CDN on and see no change in page time at all: the files now come from nearby, but the page is still built from scratch on every visit. For WordPress the first cache is still the server one, and ours run LiteSpeed, which is explained in what actually makes a difference.
2. Compression and transport
The CDN repackages what it delivers, usually better than the server does: it compresses text, uses newer transport protocols, and keeps a connection open between itself and the server instead of opening a new one for every request.
This family is the safest of the lot: switch it on, it works, nothing breaks. It is also the one with the quietest payoff, because you do not see it on a screen, you see it in a measurement.
|
Compression is not minification. Compressing wraps the file for the journey and unwraps it at the end: not one comma of the content changes. Minifying rewrites the file. The first is safe; the second belongs in the list of things that break sites, further down.
|
3. Images
Some CDNs rewrite your images: shrink them to the size they are shown at, convert them to lighter formats, and load them only when the visitor scrolls that far. On Cloudflare, several of these options are not on the free plan. Check their dashboard for what your plan actually offers before counting on it.
|
None of this excuses you from shrinking images before uploading them. A four megabyte photograph on a page that shows it eight hundred pixels wide is still a mistake, with the best CDN in the world in front of it. Fix it at source: it is the biggest single win and it is free.
|
4. Protection
The CDN sees all the traffic before we do, and it can refuse it. That buys you four things:
| 1 |
Volume attacks absorbed. Traffic it refuses never reaches the server, so it spends none of your account resources.
|
|
| 2 |
Rule based filtering. You can block or challenge requests by address, by country, by path or by pattern.
|
|
What we do at our end, which holds with or without a CDN, is in what we do about security.
|
A blocking rule catches the people you want too. If your site receives callbacks from a payment method, or from any service that writes to it unprompted, a rule that blocks countries or challenges everyone will block those callbacks as well. The symptom is horrible to diagnose: the customer pays and the order is never confirmed, with no error in sight. See an online shop with local payment methods.
|
The fifth family: the ones that rewrite your code
They sit outside the four on purpose, because they are not delivery: they are edits to what you wrote. Combining and minifying stylesheets and scripts, deferring scripts, hiding e-mail addresses in the text. Each of them buys tenths of a second and breaks menus, forms and carts with impressive ease.
|
One at a time, and use the site properly after each one. Open the menu on a phone, send the contact form, and buy something if you sell. Switching five options on at once may well work, but on the day it breaks you will not know which one did it.
|
The full list, option by option, with the ones worth having and the ones that cause trouble, is in the Cloudflare options worth having. For WordPress, the cache rules have an article of their own: cache rules for a WordPress site. And if you are still deciding whether you need a CDN at all, start at what a CDN is and when it makes a difference.
|
Switched one of these on and the site went strange? Tell us which one and we will look at it with you.
Open a support ticket
|