CloudFlare and MaxCDN are both providing CDN services along with some added features. Both have few specific qualities which keep them always competitive. Generally CDN’s are desired for improved performance and then other features like security come into role.At first, I like to discuss the basic idea of website delivery without CDN and then go into the CloudFlare and MaxCDN delivery concepts.
How webpage is loaded in browser
This is the first basic question which we should be aware of before going into other details. I don’t want to display a complicated picture of webpage loading by going into several technical terms but I just want to convey basic concept of website loading into the browser so that CDN concepts can be understood easily.
When we enter the website URL in browser, it collects IP address of the web server which is hosting that website.
How browser finds IP address of webhost?
There are several places where IP address of web host is available. Browser maintain few record, your router maintains few record, and your ISP maintain few record. These are nearest places which can provide IP address of web host. If address is not available in your proximity, then next level of domain name servers are contacted. This is a chain process where a next higher level of authority is contacted for getting the IP address of particular domain name.
So the browser collects HTML page, linking document and complies everything to form your webpage. The process of webpage render by browser is itself a topic of interest but I am confining it within few words to avoid unnecessary diversion from the topic.
How does website work without CDN
How does MaxCDN work
When we configure MaxCDN, we change the URL of static component which we plan to host on MaxCDN. This URL changing process is through applications. If your primary domain is example.com then these applications just change the primary domain URL to MaxCDN server URL. The browser do not find any difference for total number of downloaded files so webpage rendering is done similarly.
How does CloudFlare Work
The CloudFlare operation is little different. It takes control of complete website. CloudFlare servers acts like proxy servers. When we activate CloudFlare, all the primary domain requests are terminated at CloudFlare servers. This is done by changing the name server record.
So all the URL requests land on CloudFlare server which initially check for the security issues and then it check for cached components available in CloudFlare server. Generally CloudFlare does not cache html so the html file request is completed by your web host. CloudFlare applications automatically read all the linked documents of your webpage. CloudFlare cache static components which are hosted in your web server. Third party static components are not cached by CloudFlare.
So this way, only HTML file is served by web server .Other static component, hosted at the web server are now served by CloudFlare CDN servers from their cache.
CloudFlare has option to cache everything in their Custom cache option available in the page rules settings. If you cache everything then CloudFlare servers maintain cache of all type of files like html, css, js etc. In this case, CloudFlare servers serve all the resources (except third party resources) for webpage. This option completely isolates your web server for public delivery of webpages. This improves speed of delivery but it is useful only for webpages which contain static kind of information. Dynamic webpages like admin pages, login pages etc should not be served from CDN.
I think the above discussion would have given basic idea of CloudFlare and MaxCDN operation. You can use both the CDN simultaneously also.