How to use CDN with CloudFlare
Important noteThis tutorial assumes you have already created a pull zone. If you plan on using custom domains to pull files from CDN you should setup your CNAME records within CloudFlare DNS editor – not at hosting cPanel end!
What is CloudFlareCloudFlare is a free system that acts as a proxy between your visitors and our server. By acting as a proxy, CloudFlare caches content for your site, which lowers the number of requests to our servers, but still allows visitors to access your site.
What is CDNCDN stands for Content Delivery Network, and it works by acting as a reverse proxy that caches all your static contents and serves them to your website visitors from servers spread across the globe, that lowers the number of requests sent to your servers to zero at any given moment as long as the cached files are neither expired nor purged from the network. When the static contents are served to your website visitors from servers that are closer to them than your web server, the website load speed increases which provides a better user experience along with leveraging load off of your web server
First ConflictThe way CloudFlare works includes appending cookies and custom expiry headers that look like this:
sh-4.1$ curl -I domain.com
HTTP/1.1 406 Not Acceptable
Date: Tue, 14 Aug 2012 14:31:59 GMT
Content-Type: text/html; charset=UTF-8
Expires: Wed, 15 Aug 2012 14:31:59 GMT
Set-Cookie: __cfduid=de8b7126ad3841cd0da33c69651231c901344954719; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.domain.com