Using a Cloudflare CDN Setup – 3 Easy Steps

cloudflare cdn

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 Zonealias) 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 Zonealias, 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 Zonealias 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 enabled in your zone’s advanced features page within the KeyCDN dashboard.

cloudflare CDN considerations cookies

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
  • Unlimited upload sizes
  • Real-time 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.


  1. ZE3kr

    I noticed that CloudFlare will strip the “Cache-Tag” headers that sent by my origin server, so it’s impossible to use clear cache by tag on KeyCDN, can KeyCDN support another name like “X-Cache-Tag” or “X-KeyCDN-Cache-Tag”, so it will works!

      1. ZE3kr

        CloudFlare also support clear cache by tag, I think this is the reason why they remove it. However, I already asked their support just now.

  2. Cody

    Yes your static assets will bypass Cloudflare with this setup. However your HTML document and any other non-static assets will still be delivered by Cloudflare. The bypass is required due to certain issues where Cloudflare sometimes fails to cache assets as outlined in another comment regarding this topic

  3. The MonT-SteR

    I don’t quite understand how to use these instructions if I’ve already got a pull zone set up for a site. Do I add the zone URL to Cloudflare rather than my normal site URL?

    1. Cody

      You don’t need to add anything to Cloudflare if you don’t mind just using your default zone URL (which looks something like: Simply add your zone URL to your CDN integration plugin.

    1. Cody

      There should be little to no noticeable difference in speed. The main benefit to using both is that you can take advantage of the features offered by each service. However if your main goal is to accelerate your site, you can just implement KeyCDN without Cloudflare.

  4. PremiumMind

    Another benefit is that CloudFlare will actively stand between your servers and many types of attacks, such as DDoS . I think each of the services (KeyCDN and CloudFlare) compliments one another very well.

  5. steven denger

    Your directions are vague and not helpful because they leave out pertinent information that cannot be found. First – in cloudflair – I cannot enter a host name in trying to create a cname because after following your directions, it says I need a “@” in my host name and I have no idea what that is and it is not explained or found anywhere. So I an at a stand still. Secondly – there is no where in KeyCDN dashboard to “Cache Cookies” or to “Strip Coolies”. This is no where to be found and it simply should have been explained how to get there in the first place. So now – I am sure everything is going to be messed up thanks to these vague directions. I will not be able to use a zone alias and will have to delete the Cloudflair account.

    1. Cody

      Ensure that you have selected a CNAME record within CloudFlare and have added “cdn” to the name field as well as your KeyCDN URL to the value section. Also, the cache cookies and strip cookies are located within your zone’s advanced features section. Go to the dashboard > Zones > Blue Manage Button > Edit > Show Advanced Features. If you need further assistance, open a support ticket with us directly:

Leave A Comment?