CDN Setup for Your Website
CDN setup for your website
A CDN serves static assets — images, styles, scripts — from servers closer to the visitor. For a site whose audience is in one city the effect is small; for an international audience the difference is noticeable.
What is included
- connecting the site to the delivery network and verifying it works correctly;
- caching rules: what to cache, for how long, and what never to cache;
- compression and modern protocol configuration;
- an SSL certificate on the network side;
- forwarding the visitor's real IP address to the server — without it your logs show only CDN addresses;
- cache purging after a site update.
The main trap
Caching dynamic pages. If the CDN caches a cart or account page, visitors will see somebody else's data. So configuration always starts with a list of what must not be cached.
The second typical problem is payment providers. Their callbacks to your site can be blocked by the network's protection, and payments stop being credited. Those URLs need explicit exceptions.
When a CDN is not needed
If all your visitors are in one region and the server sits there too, the gain will be minimal. In that case the same money and time are better spent on server optimization, which will deliver more.
Tags: cdn, cloudflare, performance, caching, ttfb