Now, I would like to know the technical details of this mechanism. Here are some of the questions I have:

Does CloudFlare act as a cache proxy? Say I have a bunch of images on the pages of my site. Does CloudFlare cache all those images on each of their data centers and then serve them from those data centers?

Which site resources are affected? Only static ones? What about the web pages themselves (the HTML documents)? What if the pages are dynamically generated by my server? How does CloudFlare make sure to always serve the most up-to-date version of the page?

What about POST requests to my site (e.g. a visitor uploading data via Ajax which is then stored in the database)? This stuff has to be executed on my server. So, CloudFlare doesn't (and cannot) increase the performance of this process, right? So, CloudFlare just relays the Ajax request to the original web host?

2 Answers
2

"It depends". By default only things like images and CSS are cached, but you can set the cache level per zone and set Page Rules to override what is cached or should not be cached. Static HTML can be forced to be cached by a page rule, but dynamic content obviously cannot. The exception here is if you have the Business or Enterprise plan, or sign up through certain hosting partners, where you gain access to the Railgun technology whereby CloudFlare will only fetch the information that has changed on a page, even if it is dynamic. If you've set CloudFlare to cache everything, you need to control cache timeout either with cache headers on the origin and/or setting the cache TTL on your zone in the CloudFlare UI.

POSTs must always be sent to the origin, so CloudFlare just passes them straight through. You should still get an increase in performance because CloudFlare uses anycast to serve DNS and HTTP from the closest data centre.

"Does CloudFlare act as a cache proxy? Say, I have a bunch of images on the pages of my site. Does CloudFlare cache all those images on each of their data centers and then serve them from those data centers?"

You can extend our caching beyond static content with PageRules.

Note: We will not cache third-party resources that are on your site (Flickr, Google, Facebook, etc.).