23

What I understand so far:

  • You keep your current web hosting, but you change the DNS servers for your site from the DNS servers of your current hosting to CloudFlare's DNS servers.
  • CloudFlare serves your website's resources from multiple data centers around the world.

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

  1. 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?

  2. 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?

  3. 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?

migrated from webapps.stackexchange.com Jan 5 '14 at 1:31

This question came from our site for power users of web applications.

23
  1. Yes, it's a caching reverse proxy.
  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.
  3. 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.

Full disclosure: I work for CloudFlare.

5

Just to add a little more clarity:

There's a pretty good article on Quora about how CloudFlare works.

Which site resources are affected? Only static ones? What CloudFlare caches by default.

"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.).

1

To add to Damon's response:

You can find some helpful video tutorials for setting up the most popular/recommended Page Rules with CloudFlare here:

cloudflare.com/features-page-rules

Also, if you have maxed out your available Page Rules on your current plan you will soon be able to purchase additional rules without changing plans.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.