How to Make Netlify Work in China?
How to Make Netlify Work in China?

TLDR; This Netlify China article provides you with a simple solution to get your Netlify powered websites working fast, stable, and compliant in China.

Does Netlify Work in China?

No. If you want to learn why please refer to this article, where we took a deeper dive into explaining why Netlify doesn’t work in China.

In this article, we will give you a detailed solution on how to make Netlify work in China using the tech you are already using.

Getting your Netlify site working in China

We have two solutions for you to choose from, both of these solutions offer the best loading time experience to your website’s readers.

Before we get straight to the solutions, let’s take a look at why Netlify is slow in China first. The answer is that they don’t have any CDN (Content Delivery Network) nodes or servers inside China. But what does this mean? Yeah, I know it sounds confusing to you, but I promise if you read through this blog, I will explain it to you in plain words and give you actionable solutions at the end so you can put it into action and see the outcome in days.

What causing the slowness or inaccessibility of your website in China?

If we look at how CDN works at a high level and say you are making a change on your website. Here are what happened behind the scene:

  1. When you git-push the changes via any version control systems, such as Github, Gitlab, and Gitee, the hosting provider backend (the popular ones outside of China are Netlify and Vercel) will receive a “build and deploy” message from the version control systems. Then,

  2. The hosting provider will pull the content from the servers of external systems, such as headless CMS Contentful, Strapi, and Sanity, and build the website inside the hosting provider’s servers.

  3. Once the site is done building, the hosting provider (Netlify) will deploy the web pages on their content network.

If things go well with the above steps, the changes you just did to your website will be live and publicly accessible within the content networks by the hosting provider and the CMS provider.

So what happens when a user visits my website? The hosting provider will find the nearest server to the user and deliver the web page content from that server. The media assets also do the same when a user requests the content.

With that being said, what could go wrong here?

When your web hosting provider or the media assets provider has no servers in China, the default action they do is to find the nearest server (most likely to be in Hong Kong or Singapore) within their content network and serve the web page content and media from that server to your users. That’s the reason why your readers access the content fairly slowly in China. Here are the CDN locations that Netlify provides:

Netlify CDN Locations (as of Apr 2021),
Netlify CDN Locations (as of Apr 2021),

So based on what Netlify’s staff said, we can tell if you aren’t going to subscribe to their “Enterprise” subscription plan, the nearest CDN or server that your web page content will be served on Singapore. Meaning when your users from China visit your website, your web page content is in Singapore.

Even if you buy their “High-Performance CDN”, you will be unlocked to use more CDN nodes, the nearest CDN you can get are Incheon in South Korea or Tokyo in Japan.

Now that we understand the problems then the solution is straightforward. Simply put, what your need is: a website hosting provider in China that integrated well with your existing CMS.

Hopefully, by now, you have a good understanding of why your website with Netlify is slow in China, now we can move to the solutions, and the solutions should address the problem well and should give you better integration with the technology you are using.

Solution 1: Optimize for Cost

If your website is just a static site, you can host it on AWS S3 Beijing Region or Aliyun OSS, this basically guarantees you have a quick load time inside China, because both of these hosting providers or file storage providers have many servers inside China, and you can purchase their business level support to get more help if needed.

Since AWS S3 and Aliyun OSS are just file-hosting services, this means you are only paying for the bare costs of file hosting and bandwidth. This also means your engineering team needs to allocate time to set up a CI / CD, (Continuous Integration / Continuous Delivery) pipeline on your own tools such as Jenkins, or Github Action to mimic the experience you have on Netlify.

If you go with Jenkins, it’s not free, instead, you need to buy additional servers and possibly hire ops engineers to help you manage it regularly.

If you go with Github Action, it comes with a free tier, but be sure to check the load time between Github’s servers to the servers you are pulling content from in China before you put more effort into it.

From our years of experience working cross-border in Beijing, Shanghai, China, and San Francisco, our engineers usually faced challenges of getting stable services with Github (assuming no VPN or proxies are used) while in mainland China’s office.

So Github doesn’t give us the stability we are looking for to meet our day-to-day work in China and the rest of the team remotely. If we have a project mainly for China, we will use the Github alternative Gitee instead. This gives us a better speed and much stabler performance in China.

I guess it’s enough on the topic of CI / CD tools and version control tools. There are many other CI / CD tools out there that you can choose from to mimic what Netlify provides, but at the end of the day, to give your website a speed boost in China highly depends on where you put your web page content at.

So back to the main topic, say you have picked your CI / CD tool, set up a proper workflow that works well with your team, and finally choose the file hosting services, then you can route traffic from your domain to the web page content in China.

Sounds like a lot of work? Yes, but it gives you the flexibility to do it in your own ways and optimize for the cost.

Solution 2: Optimize for Cost and Simplicity

If solution 1 overwhelms you with the complexity and the tools and services that you need to use and maintain regularly, solution 2 will give you a simplifier and more cost-effective solution.

You can use 21YunBox to deploy your site in a Netlify fashion, meaning the deployment settings you are currently doing with Netlify, you do the same on 21YunBox.

Netlify + 21YunBox for the global market
Netlify + 21YunBox for the global market

What makes 21YunBox work better than Netlify in China?

21YunBox CDN has full coverage inside China that Netlify doesn’t have, this will give your site a speed boost for your readers in China. 21YunBox also makes Github available to your developers in China. Like we said above Github doesn’t work in China, or it’s blocked or inaccessible well in China, 21YunBox utilized dedicated networks to make it possible for you to use Github inside China. So this enables your team to stick with the technology that you are using and gives you a huge speed boost in China.

Talk is cheap, let’s show your engineers some code 😎

Here are some guides and the corresponding source codes to get your engineers started and experienced the speed boost with 21YunBox:

There are more guides and starters on our docs or you can search this blog to find out more.

We took the Hexo starter (just a simple static website) to conduct the speed test (the speed boot is not limited to Hexo, it works for other static site generators or frameworks too), we deployed it on Netlify and 21YunBox so you can see the speed test side by side. This is what the Hexo starter looks like visually

Hexo starter deployed on Netlify,
Hexo starter deployed on Netlify,

Speed boosted Netlify with 21YunBox in China (Before vs After)
Speed boosted Netlify with 21YunBox in China (Before vs After)

Speed boosted Netlify with 21YunBox in China (Before vs After)

The left one shows the load time with Netlify CDN vs the right one shows the load time with 21YunBox CDN. You can see 21YunBox gives you the performance boost (mostly solid green, meaning the site is loaded within 0.4 seconds).

Hopefully, by now, you have a good understanding of why your website with Netlify is slow in China, and what you can do to fix it.

Ready to make your app work in China?

Get Started Questions? Talk to an expert.

Ready to try 21YunBox?

Get Started