Determine If a File or Page Was Served by CloudFlare and If It Was Cached

Nov 24, 2015   Web Development   Nick Vogt   Comments (2)
Please note that this post is over a year old and may contain outdated information.
Open Developer Tools in Chrome or Internet Explorer, or Inspector in Firefox (shortcut is F12 in all browsers), and find the Network tab. This is the tab that shows you all http requests made and will look a little different on each browser. It may not be populated until you refresh the page you're on or visit a site after having the window open.

Network Tab
Once there are results in the Network tab, click on a request that you want to analyize and check for two CloudFlare response headers: CF-RAY and CF-Cache-Status. The CF-RAY response header is a unique ID from CloudFlare, and indicates that the resource was served through CloudFlare. The CF-Cache-Status response header indicates specifically if the file was from the cache or not.

CloudFlare Cache Status

If the value of CF-Cache-Status is HIT, then that resource was served from CloudFlare's cache. If there is no CF-Cache-Status response header or it has a value of MISS or EXPIRED, then the file was not served from the CloudFlare cache. This usually occurs if it's the first time a file has been browsed to or if the file is dynamic (PHP, ASP, etc).
Share This Post

Comments (2)

Jay Holtslander   Aug 20, 2018
An easy way to test if a resource was served by CloudFlare's CDN or not is to run the URL through https://cf-cache-status.net
Jean Luke Picard   Jan 21, 2017
We are using Softlayer.com server for our website : [https://www.purelocal.com.au][1] Because SoftLayer charge us about $1 per GB in bandwidth we put our site on CloudFlare to reduce costs and to make it faster.... Now we find out that most servers include response codes to block malicious hacks and these response headers block cloudflare from caching... Feeling completely ripped off by Cloudflare now for taking our payment without checking our domain was even compatible in the first place. Cloudflare ask us to remove the response headers blocking their caching and our server says they won't remove it because it's crucial for security. I've tried to override the cache headers in .htaccess to no avail. Can someone please explain why Cloudflare are doing this paying customers? Rip.Off. [1]: https://www.purelocal.com.au
Share This Post
H3XED © Nick Vogt   RSS   Policies   Twitter