Cloudflare by default only caches the static resources, such as images, audios, documents. If your site does not have dynamic contents or is updated less frequently (e.g. if you don’t care updating guests comments in real time), then you can also cache everything (including the dynamic PHP pages), which certainly offloads your origin server.
The free plan for Cloudflare CDN allows you to add 3 page rules so make sure you use them wisely. For the Pro paid plan, you can add up to 20 page rules. To cache everything, you would first add a page rule, specifying the URL pattern, and select ‘Cache Everything’.
The Edge TTL is the time that you want the CloudFlare servers come back to your origin server to check if cached contents/pages need to be updated (re-fetched). The shorter, the better, but for Free Plans, the shortest period is 2 hours while I am on the paid Pro plan, so this settings is improved to 1 hour.
After enabling the ‘Cache Everything’, the cached contents are increased, and it means that the more requests are handled by CloudFlare servers and less requests are forwarded to my own server.
If you expect a large traffic, or if you experience large Deny-DOS attacks, or if you don’t expect updating too often the contents (such as images, static pages), or you don’t care the real time update (updating new contents every 2 hours), then this is actually a great caching method for you!
PS: You might want to by pass other dynamic contents such as wp-admin.
CloudFlare Technology
- CloudFlare: Change Security Level Value Programmatically for Multiple Domains via PHP/Python/Bash Script
- How to Transfer Domain From Namesilo to CloudFlare Registra?
- A Simple Rate Limiter for CloudFlare Workers (Serverless API) based on KV Stores
- Cloudflare Worker Unexpected High Usage of API Requests - How to Avoid Surprising Billing?
- Tutorial: How to Set Up a API Load Balancer by Using CloudFlare Worker?
- How to Fix CloudFlare Error 1101 (Worker threw exception)?
- Using CloudFlare Worker Serverless Technology to Deploy a Load Balancer (RPC Node) for Steem Blockchain
- Set Up Website Health Checks (Canaries) using CloudFlare
- CloudFlare Internet Summit - Recaps
- Does CloudFlare Cache 403 and 503 By Default?
- The PHP Page Rule Checker of CloudFlare
- Cloudflare Offers Dedicated SSL Certificates
- How to Clear CloudFlare Caches of Multiple URLs using PHP Script with CloudFlare API?
- Does CloudFlare (Cache Everything) Affect the Adsense?
- Posting SQL code on bbForum Triggers Security Rules by CloudFlare
- How to Offload Your Server by Using CloudFlare - Cache Everything?
–EOF (The Ultimate Computing & Technology Blog) —
loading...
Last Post: How to Check If One or More Users Are Logged in using Cookie in WordPress?
Next Post: Huawei Honor X2 MediaPad Review - Amazing Phone Tablet!
Thanks for The Tutorial But This Method Also Wp-admin And Login Section Of WordPress.
Any Page Rule For That.
You can create rules to bypass cache for wp-admin etc, and put those rules before the cache-everything
“Cloudflare by default only caches the static resources, such as images, audios, documents. ” — Wrong- no audio is cached. They have a list of file that get cached.
“(including the dynamic PHP pages)” ??? my server only emits html pages. I don’t think cloudflare can cache php because they should never see php pages. However there are ways to generate and freeze html from a php script and then just have the origin server emit the frozen html; like WP Super Cache for wordpress users.
How do you purge Cloudflare `cache everything` caches?
I found Cloudflare caches and WordPress posts out of sync when I publish/update a post. Thus, I write a plugin to purge via Cloudflare API. What’s your tricks?
Thanks!
https://wordpress.org/plugins/sunny/
In CloudFlare, there is a button to purge everything.