Overview
Cloudflare’s caching features accelerate your website by storing copies of your static content (like images, CSS, and JavaScript) on its global network of edge servers. By serving content from a location closer to your visitors, you reduce latency and decrease the load on your origin server.
Step-by-Step:
- Login to your Client Area account
- Navigate to Cloud Services > My Products & Services and select your Cloudflare service.
- On the left-hand sidebar, select Caching and then click Configuration.
1. Purge Cache
If you have updated your website and want to ensure visitors see the latest version immediately, you can clear the stored files from Cloudflare's network.
- Custom Purge: Allows you to clear the cache for specific URLs.
- Purge Everything: Instantly clears all cached files. Use this after major site updates.
2. Set Caching Level
Determine how Cloudflare handles static content based on “query strings” (the extra info at the end of a URL, like ?id=123):
- No query string: Only delivers resources from the cache when there is no query string.
- Ignore query string: Delivers the same resource to everyone regardless of the query string.
- Standard: Delivers a different resource for each unique query string.
3. Browser Cache TTL
This setting instructs a visitor's browser how long to keep files in its local cache.
- Select a duration from the dropdown menu (e.g., Respect Existing Headers or specific time frames like 4 hours).
- Longer expiration times speed up page loads for returning visitors.
4. Always Online™
Toggle this switch to On to keep your website online for visitors even if your origin server goes down. Cloudflare will serve a cached version of your most popular pages until your server is back up.
5. Development Mode
Enable this when you are making active changes to your site's code or design.
- Auto-Expiration: Development Mode stays active for 3 hours before automatically turning off.
- Effect: Temporarily bypasses Cloudflare’s cache so you can see changes to your origin server in real-time.