top | item 19457709

So you want your app/website to work in China

327 points| chanind | 7 years ago |chanind.github.io | reply

157 comments

order
[+] victornomad|7 years ago|reply
My best best advices are not listed there

- Stop using Google CDNs

- Stop using Google fonts

- Don't put Google Analytics in the header (or don't use it) otherwise will block/delay the browser load the website.

Most of the websites just timeout because of those 3 things and make the website imposible to navigate.

If you host your website in a normal VPS, without using Google services you will have a quite nice chance that the website loads pretty fast there in China.

edit: formatting

[+] chairmanwow|7 years ago|reply
My biggest frustration while browsing in China was reCAPTCHA. Most websites would load fine, but then they would detect that I was in a new location and this would trigger their account protection bullshit and ask me to complete a reCAPTCHA that...wouldn’t load. This happened ALL THE TIME and is just excruciating.

Sometimes there wouldn’t even be UI that would load to indicate something was wrong. Logins would just fail with cryptic messages.

[+] userbinator|7 years ago|reply
IMHO good advice even when you're not looking specifically at China.

I know some enterprise environments are, not surprisingly, not too fond of 3rd-party scripts, and their firewalls could be nearly as bad too.

[+] solstice|7 years ago|reply
The Decentraleyes Firefox extension alleviates this somewhat as it caches popular things like jquery (that are often hosted by Google) locally on your device, making foreign websites load quicker.
[+] trojanh|7 years ago|reply
> - Stop using Google fonts

I think we can avoid Google font CDNs for fonts but we can use them from our assets i.e download the font and use it from your assets instead of Google CDN.

[+] tonyaiken|7 years ago|reply
You can still use them, but a different URL. Google has a CDN in China for those fonts and stuff. Also Google Analytics are not blocked at all in China.
[+] swuecho|7 years ago|reply
you are absolutely right.

Stackoverflow use Google CDN. The one to be blamed is the chinese GFW. but it will be much better if they do not use google service. Maybe they do not bother to serve user in china.

[+] yixiang|7 years ago|reply
I'm Chinese. It's not that bad.

* I've been hosting my Chinese blog in US vps since 2009 and it works fine.

* I have Gitea hosted in US vps and it works fine too.

* GoDaddy has Alipay (sort of China's PayPal) up for a long time.

* ICP Licenses are easy to get (at least for Chinese) and typically take less a month. I've done it for my company's websites and my clients' websites.

* ICP licenses are required only if you want to host your website in China. Hosting in China is ridiculously expensive and many Chinese go out of their way to host elsewhere. For 9$ a month you get 1 cpu, 1G ram and 1MBit bandwidth, which translates to 128kb/s.

To make your website load, and load fast in China:

* Remove Google fonts, Google cdn, resources from FB, twitter, etc. this should fix 95% of your problem.

* Avoid well-known host providers (AWS, Vultr, Linode) if you can, they tend to get banned.

* Get a host with CN2. I heard hosting in Hong Kong is fast too. It's only necessary if you really want your site to be lightning fast. As a Chinese, if I'm visiting your website and your website is in English, then I probably expect it to be slow, so...

[+] yixiang|7 years ago|reply
CN2 is basically a fast lane to China that you can buy from one of China's biggest internet providers (China Telecom). It has two flavors, CN2GT[0] and CN2GIA[1], CN2GIA is said to be faster.

Some vps providers buy these fast lanes, make their vps fast to access in China, and sell them to hungry Chinese users. The most popular one is Bandwagon[2].

[0] https://www.ctamericas.com/products-services/internet/global...

[1] https://www.ctamericas.com/products-services/internet/global...

[2] https://bandwagonhost.com/cart.php

[+] continuations|7 years ago|reply
> Hosting in China is ridiculously expensive and many Chinese go out of their way to host elsewhere

If I host in Europe or US would the speed of traffic going into China be very slow?

If I get a 1Gbps server in EU most likely I can serve 1Gbps to USA. Will I be able to serve 1Gbps to China from that EU server?

> For 9$ a month you get 1 cpu, 1G ram and 1MBit bandwidth

That is insanely expensive. How can startups in China handle that kind of hosting cost? Where do they host their websites?

> Get a host with CN2

What's CN2? Where can I find their website?

[+] intellix|7 years ago|reply
How do you manage to work during the night? External internet gets throttled so much that trying to load pages like Gitlab take minutes and a simple `git pull` can take 5 minutes. All VPNs stop working and even obscure sites like payment providers and Slack seem to only run at around 5kbps. I'm guessing it's not normal for people to work outside of 9-6?
[+] fungi|7 years ago|reply
> Get a host with CN2. I heard hosting in Hong Kong is fast too.

Tested Alibaba Cloud in honkers from Shenzhen and Guangzhou late last year for a couple weeks as a Shadow Socks host. Worked really well, <10milsec ping.

That said, its not day to day that i've had probs with Honker <~> Mainland traffic. It's the seemingly random network performance degradation that bites.

[+] haxpor|7 years ago|reply
Thanks, I live in China too. I want to know is it easy to update ip address associated with ICP license? I seek an option to transfer from more expensive to cheaper vps solution and want to maintain icp license I already got.
[+] laurent123456|7 years ago|reply
Do GitHub releases (downloadable files hosted on GitHub) work well in China in general?
[+] zoom6628|7 years ago|reply
Ive lived in mainland China most of last 12 years and work in software. The last paragraph is key one for most websites. You have to remove use of all G, FB and related site scripts because these will not run. There are good alternatives anyway so do yourself a favor and replace them with self-hosted or other 3rd party alternatives.

There are sites for testing what is blocked in China - you should test all 3rd party scripts you are using to make sure they run ok.

[+] rqs|7 years ago|reply
Just read the article again only to realize the late paragraph was not "Good luck! Please enable JavaScript to view the comments powered by Disqus." LOL

Anyway, before I had a stable proxy, I actually set up my local DNS to redirect all .google.com., .facebook.com. and their CDNs to 127.0.0.1 just so I can "unblock" some other webpages. That was not a good experience.

Those script can actually be delayed from loading so they won't block the page. You don't need to actually remove them, just load them AFTER your page is loaded, and then most things will be fine. (Except for Google Recaptcha of course)

It's a good practice to un-trust everything you don't have control, and maybe make exceptions from there. Don't by default trust everything.

[+] fungi|7 years ago|reply
we moved everything we could to a mainland provider, generally there are good alternatives and cdn's for common stuff. what keeps biting is our tracking and re-conversion scripts that our marketing team insists on.
[+] crazygringo|7 years ago|reply
I'm really confused.

I have a fairly international website geared towards English language learners, with Google Analytics and AdSense and links to share on Facebook, hosted on Digital Ocean here in NYC...

and, without designing for it, China has been my #1 source of traffic and revenue for many years now, simply because they're the #1 largest population of English language learners.

It seems to be working fine. I mean, maybe my share of Chinese traffic could be even bigger, but does anyone have any hard numbers showing this is a problem? Or are Chinese users aware of slow loads but just put up with it?

[+] echevil|7 years ago|reply
If your website doesn't use anything that's being actively blocked by the firewall (e.g. Google CDN), it is most likely usable in China, although it'd be quite slow.

I browse tons of foreign websites when I grew up in China. It's actually not a big issue if the website doesn't serve video.

[+] chillacy|7 years ago|reply
VPN usage is popular, even more so among the educated who might want to improve their English. That’s who you’re targeting anyways right?
[+] edwinyzh|7 years ago|reply
Don't get confused, the gov blocks websites with a clear purpose and your English learning website definitely is not on their blocking list.
[+] Elect2|7 years ago|reply
Analytics and Adsense are not blocked in China.
[+] elamje|7 years ago|reply
Not that this is a recommended solution, but VPNs work from inside of China.

I lived with some Chinese students while I was exchanging and basically they said most people that want out of the Fire wall can just VPN out with no repercussions expected. Not that it’s ideal, but some commenters seem to believe that people in China have no access to the outside world which just isn’t true.

Before the internet the USSR could censor effectively, but now it’s pretty hard with encryption being as good as it is.

Of course there are people in China that don’t know that VPNs exist, but I think it’s an important nuance to mention that many people are able to have an open online experience.

[+] hw|7 years ago|reply
Didn't China ban VPN or at least started to issue fines to people who were caught using VPNs? Unless they backtracked on that..
[+] morkfromork|7 years ago|reply
I want the opposite. I want to block China and Russia and a few other countries that constantly try to hack my site.
[+] matthew-wegner|7 years ago|reply
You can block whole countries with the free CloudFlare tier. (Or give them CAPTCHA style challenges)
[+] miaklesp|7 years ago|reply
Your site should be very important that everyone tries to hack it.
[+] ashton314|7 years ago|reply
I traveled to China for about a month and a half a few years ago. Everything was excruciatingly slow. Except for Hacker News. Probably more about the payload size than anything else. :)

How many companies work hard to make their services readily available in China? Any notable exceptions?

[+] tilolebo|7 years ago|reply
My 2 cents running your app in China:

* make it as decoupled as possible from your core infra. What you spare on infra costs caused by redundancy, you will spend in maintenance time, outage mitigation, etc.

* no synchronous call going out of China mainland, otherwise you become dependent of the Great Firewall and that is not something you want

* expect lower quality of documentation and support

[+] chvid|7 years ago|reply
"Sadly, it’s not so simple. If your app/website servers aren’t hosted from within China, then, for all intents and purposes, it’s blocked. I mean, it will probably technically load, but will be excruciatingly, unusably slow. And sometimes it will just not load at all for hours at a time."

Is that really correct? And are there any sort of systematic measurements of that?

I seem to remember from my travels in China that accessing my websites hosted in Denmark was ok, certainly not stellar, but better than Australia.

(The rest of the advice: Don't use FB and Google - absolutely a good idea.)

[+] zzzeek|7 years ago|reply
I host sqlalchemy.org on Linode, it has a google analytics loader on it, and I've had several complaints that the website cannot be loaded in many regions of China.
[+] icedchocolate|7 years ago|reply
Honestly, I wouldn’t make it available in China. I want to give them a reason to take that firewall down. I don’t want to make the prison that their government has turned their country into, a sustainable one.
[+] Can_Not|7 years ago|reply
I really want the opposite, I want Google Cloud to stop billing me for Chinese users I don't have. Apparently the technology to bill me extra for Chinese bandwidth is not available for making firewall rules.
[+] vfulco2|7 years ago|reply
I remain completely disgusted and confused why websites hosted on AWS S3 (in BJ) by fully registered firms with valid ICPs are still banned. I have to use 10x the computing power that I need and I could load additional tools in its place. That and the lack of AWS Amplify being offered really crushes innovation here. (Shanghai based entrepreneur)
[+] avinium|7 years ago|reply
Has anyone registered an AWS China account without a Chinese company?

The application process requires you to select a Chinese city/postcode.

[+] teknologist|7 years ago|reply
China - opening to the world. At least that's what they say...
[+] fungi|7 years ago|reply
if there is anything remotely dynamic in your app go with option 2.

i've mainland proxied and cached the hell out of everything i can, warm the caches daily, but once the user starts interacting (eg search) then hitting our servers really bites randomly. usually not so bad for honkers server, but even that route can randomly drop off the face of the planet.

[+] fungi|7 years ago|reply
hmm, option 3 looks interesting. i would need to test it to have confidence in it (especially over problematic periods like golden week), but having your server in honkers is a big plus over the other side.
[+] klaudius|7 years ago|reply
Does just having links on a page (e.g. Google Maps link or FB profile) cause slow page load?
[+] xfalcox|7 years ago|reply
Any suggestions of services that help a company obtain the ICP License?
[+] argd678|7 years ago|reply
You need a local company entity in China, I don’t think they allow it to be offered as a service. They want to know how to get in touch with you in person.
[+] xyk2|7 years ago|reply
You can look into Alicloud (Alibaba Cloud) ICP, they provide English language services to help you set up a license. Still requires a locally registered entity (whether as a WFOE or a fully registered company) but they help a lot in navigating the bureaucracy.
[+] outworlder|7 years ago|reply
You needs boots on the ground. So no.
[+] jayalpha|7 years ago|reply
I don't know out of my head (google it?) but I am pretty sure you need a mainland company.