Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question

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

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

2 Answers 2

up vote 8 down vote accepted
  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.

share|improve this answer
    
Thanks for the info :) –  Šime Vidas Jan 4 at 18:38

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

share|improve this answer
    
Thanks. Good info. –  Šime Vidas Jan 6 at 20:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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