Important note

This tutorial assumes you have already created a Pull Zone. If you plan on using custom domains to pull files from the CDN you should setup your CNAME records within the CloudFlare DNS editor, and not on the web-hosting end!

What is CloudFlare

CloudFlare 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 a CDN?

CDN 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. This can lower the number of requests sent to your server 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 loads faster, which provides a better user experience and also reduces the load on your web server.

The conflicts

  1. The First Conflict
    The way CloudFlare works includes appending cookies and custom expiry headers that look like this:

    sh-4.1$ curl -I
            HTTP/1.1 406 Not Acceptable
            Server: cloudflare-nginx
            Date: Tue, 14 Aug 2012 14:31:59 GMT
            Content-Type: text/html; charset=UTF-8
            Connection: keep-alive
            Vary: Accept-Encoding,Cookie,User-Agent
            Expires: Wed, 15 Aug 2012 14:31:59 GMT
            Set-Cookie: __cfduid=de8b7126ad3841cd0da33c69651231c901344954719; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/;

    When these cookies and headers are sent to our CDN Network, it causes a conflict that prevents us from properly caching your static assets. That results in a very low cache hit percentage, along with an increased number of requests being sent to CloudFlare, which will negatively affect the load speed of your website.

  2. The Solution for the First Conflict
    We have implemented a new option within the Control Panel, which ignores the cookie’s existence on requested files. So after the CDN pulls the file from origin, it will ignore the cookie and cache the file.
    This option is available within the Settings tab after you go to Manage Zone. Click the box next to Strip All Cookies and then click Update:
  3. Scheme for the First Conflict
  4. The Second Conflict
    CloudFlare automatically utilizes a load balancer, which dynamically changes the IP address of your website. Usually this is not an issue, however since our system depends on matching the IP address of the origin website with the FQDN/domain/URL, it will cause a conflict which will result into our servers unable to fetch and cache your static contents, generating a 502 Bad Gateway error.
  5. The Solution for the Second Conflict
    In the past we used Pull Zone 2.0, which utilized the Apache Traffic Server to overcome the dynamic IP problem caused by CloudFlare, Amazon AWS, and other load balancing techniques. Apache Traffic Server had its problems, and lacked support for GZip compression. So we re-invented the Pull Zone to add an option for dynamic IP resolution, which is enabled by default when zone is created. If you have already defined the Origin IP, you can uncheck Origin IP Resolution within your zone’s settings and then dynamic IP resolution will be enabled for that zone. Also, you can contact us at so we can make sure that dynamic IP resolution is definitely enabled for your zone.
  6. The Scheme for the Second Conflict
  • Amar Chugg

    Does it work well?

  • Ivan Dabic

    Hi Amar!
    It works perfectly because you are chaining two CDN’s where one is handling static assets (MaxCDN) and other assets are delivered by CF. This is one of the best cross-CDN setups.

    Drop us a line on if you need some detailed instructions or any assistance.

    • goran

      Ivane upravo probam da koristim MAxCDN u kombinaciji sa CF, sve sam podesio, ostalo je još CF da li je ovo ok i da li još nešto treba dodati na CF da bi Amx radio kako treba?

      • Ivan Dabic

        Hey Goran,
        CF looks good, although, only thing you are setting up with CF is CNAME so, it will simply create a custom domain on CF DNS to be used to access CDN. This can be treated as origin DNS.
        With this said, you should be all good. However, please, ping us on live chat or phone if you need more direct checkup.

  • Scott

    What would my setup be if I am using wp super cache, max cdn, and wanted to add cloudflare? Or is it not worth the headache? or should I use w3 total cache instead of wp super cache?

    • Ivan Dabic

      Hey Scott,
      Sincerely sorry for delay. Have you managed to implement CDN properly ? Don’t hesitate to reach out if you should need anything. Apologies for missing your comment.

      • Scott

        I have not added Cloudflare to my setup yet. I have currently wp supercache running properly and maxcdn running properly. I would like to add cloudflare because it is free and I suspect would give me a slight performance boost, but it is a production site and I dont really want to mess up what I have working if you know what I mean. If I had someone tell me with confidence: “Do this with these settings” I would certainly try it!

        • Ivan Dabic

          Hi Scott,
          Good info. Well, above settings are what we composed as “safe and accurate” 🙂 so, you should be fine with them as longs all steps are through. Also, you can always ping our support team to walk you through just in case. In general, the logic behind MaxCDN (any CDN) and CF in chain is that CF is treated as origin on another CDN (MaxCDN in this case).

          As for whether there is a need for it,… If CF fixes any time to first byte waited for origin you should definitely keep it. Additionally, MaxCDN will probably take shorter route to cache your files if origin is CDN as well (CF).
          At the end, the test is mother of experience 🙂

  • Welpy Team

    Here at we are currently using Sucuri and after the article, i’m wondering what you would advice : maxcdn + cloudflare or maxcdn + sucuri and what are the main difference for you. PS : congrats to your support team, always reactive and efficient.

    • Ivan Dabic

      Hi there,

      That is interesting question, however, I’d prefer not to advertise other companies here 🙂 So, I would say that performance wise, combination #1 versus combination #2 depends on a difference of points of presence (overall pops with #1 and #2). Security wise, I’d say difference is in price only.

      I’d love to discuss more on this topic directly if you are willing to, please email me at


      • Welpy Team

        Most important for us was security wise (and regarding performance we are happy with sucuri). So will keep our current configuration (the same one with cloudflare is far more expensive). Thanks for the prompt reply 🙂

  • Matija

    Hey Ivane, I’ve been reading more and more stuff here and everything is very interesting.
    In what referes to Cloudflare here, is something that I like to use with my MAXCDN setup.
    I use a little plugin called Use jQuery Cloudflare,

    This addition to my ‘cdn’ configuration gave me almost a whole second when it comes to pageload.
    I did not go into details or how it works, it just does. Check it out.

  • Andreas Nagy


    “…​should setup your CNAME records within the CloudFlare DNS editor…”

    What if I´ve signed up to cloudflare with Dreamhost? Unlike normally, in this case I do not have access to the DNS settings on CF. Will it work by adding the cname entry on Dreamhost?

    • Ivan Dabic

      Hi Andreas,
      That is correct, this text assumes your domain is hosted by CF domain register. In your case that would be Dreamhost (in case you manage domains on their CP)

  • koushil

    HI can we use maxcdn for blogspot blogs ?

    • Stefan

      Hey Koushil. Thank you for your interest in MaxCDN !

      If you are referring to Google’s blogs since you would not have access to edit the source code of the blog you wouldn’t be able to integrate our CDN.

      On the other hand if you are using any CMS platform for your website such as WordPress, integration of CDN can be completed within few minutes.

      Please feel free to start a live chat directly from our website or send us an email at if you have any inquiry about our service.

    • Nico

      And you don’t need it. If you are on blogger all your content is hosted by google. You have no server issues, no bandwidth limits, nothing to worry about.

  • cire

    I had cloudflare and maxcdn a few years ago, and had an issue where all of the IP hits were originating from cloudflare, and not hte users ip – so I was losing any of the distancing benefits of maxcdn.. is that still an issue?

    • Daniel Garcia

      No one responded to this????

      • Daniel Garcia


  • Arijit Biswas

    Excellent in depth article. thank you.