Use a CDN to improve the performance for Chinese users


I have a droplet in LON1 for almost two years, and host an important website. I also use CloudFlare on top of it.

When visiting the website from Mainland China, it is slow in general, and sometimes it is too slow to display the page. Now, I want to overcome this.

I did some research, I think I will deliver the website in China via a Content Delivery Network (CDN). Now, it seems that there are two options:

  1. DigitalOcean LON1 + CloudFlare + Baidu CDN

  2. a server + Alibaba CDN

I think the first option is doable, my question is in the second option, is it possible to keep using my current DigitalOcean LON1 server and just use an Alibaba CDN? Do I have to use a Alibaba server?

Another question is, which option do you think is better?




Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

If your site isn’t on a blacklist it should be fine to just host your content in LON1 and have the china-based CDN store your assets.

You need to change your application to reference the resources on the cdn instead of linking to your own server, so your LON1 box will serve the dynamic web content and the CND boxes will serve your images / css / js etc.

You’ll end up having to call something like this from your templates:

  function image_url(name){
     if (user_is_from_china) { return "" + name } 
    else  { return "https://your.domain/static" + name }

CloudFlare does a man-in-the-middle version of this, and they change your content on the fly - if you’re planning on having support for multiple CDNs you’ll likely need more control over the urls used in your pages.