Find answers, guides, and tutorials to supercharge your content delivery.

Using a Cloudflare CDN Setup - 3 Easy Steps

Updated on October 4, 2018
Using a Cloudflare CDN Setup - 3 Easy Steps

This tutorial walks through the process of setting up a Cloudflare CDN combination with KeyCDN. Cloudflare is different than most conventional CDNs in that your complete site is delivered via them whereas with a normal CDN, only the static content is delivered and via the CDN. When Cloudflare is used in combination with a CDN, it acts as a proxy for websites by sitting in between the CDN servers and the end user.

Cloudflare is also a free DNS hosting provider which means if you are using them as a DNS hoster, any DNS changes (such as adding a Zone Alias) must be made through the Cloudflare DNS manager.

How to use a Cloudflare CDN setup

Using a Cloudflare CDN combination with KeyCDN is easy and can be done in just a few steps.

  1. Create a Pull Zone within the KeyCDN dashboard.
  2. To use a Zone Alias, follow the instructions in our Create a CNAME record in Cloudflare guide. Otherwise, there is nothing that needs to be modified within Cloudflare and the Zone URL (e.g can be used.
  3. Use either the Zone Alias URL or the KeyCDN Zone URL for CMS, framework, or custom CDN integration purposes.
    WordPress CDN Enabler Plugin integration with Cloudflare

That's it! Now your website is using a Cloudflare CDN combination, thus allowing you to use the features from both services in unison.

Other Cloudflare CDN considerations

Cloudflare adds a Set-Cookie header to domains that are routed through Cloudflare's system. These cookies can be seen by running a curl -I command from the terminal.

curl -I
HTTP/1.1 200 OK
Server: cloudflare-nginx
Date: Thu, 10 Dec 2015 14:46:10 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
**Set-Cookie: __cfduid=d43b3b2852bb7399a3191473c62d071181449758769; expires=Fri, 09-Dec-16 14:46:09 GMT; path=/;**; HttpOnly
Last-Modified: Fri, 04 Dec 2015 20:06:15 GMT
ETag: W/"13c354-4dbd-526180a2fb568"
Vary: User-Agent
CF-RAY: 2529bcd81a0f3024-YYZ

Files with cookies cannot be cached which means that if the cookie remains present in the file, it will not be delivered via the CDN. To solve this issue, the Cache Cookies and Strip Cookies options should be set to enabled in your Zone settings within the KeyCDN dashboard.

Cache Cookies will ignore the cookie and will force the edge server to cache the file. Strip Cookies actually removes the cookie from the header, therefore the client will not see the Set-Cookie response header. Both of these options are enabled by default in KeyCDN and it is recommended to enable Strip Cookies if Cache Cookies is enabled.

How does using a Cloudflare CDN combination help?

Using a Cloudflare CDN combination can offer many improvements to a website. Since Cloudflare is based on a freemium model, there are many features that are not available to users without paying a higher price. Using Cloudflare in conjunction with KeyCDN provides users with many additional features such as:

  • Origin Shield
  • Secure Token
  • Let's Encrypt support
  • Push Zones
  • Wildcard subdomains
  • Detailed analytics

As can be seen, there are many benefits to implementing a traditional CDN with Cloudflare, thus providing more features and flexibility for the user.

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more about cookies.