How a proxy cache server works for fast page access in China
Posted by , Last modified by Marc Füßlein on 03 January 2022 17:44
With a proxy cache server, you can provide access to your website in China with good performance and still manage your system via your existing web server in Europe or America; you do not need to operate and maintain a second web server in China.
In addition to the reduced effort, as your Chinese website is operated on the same web server as the rest of your website, this solution also provides the following advantages in terms of data protection: The proxy cache server only caches the completely generated websites in China, so the actual source code of your application and the corresponding databases do not have to be stored on a server in China.
The proxy cache server has four decisive components: the users and the proxy cache server in China, the direct connection between China and Europe, and your existing web server in, for example, Germany.
The actual domain (e.g. your-selected-name.com) of your Chinese website points directly to the proxy cache server. This, in turn, must be able to establish a connection to your web server in Germany. For this purpose, your web server can be accessible via another domain or subdomain (e.g. www2.your-selected-name.com) or simply be accessed using the IP address and a corresponding host header, enabling your-selected-name.com to be used on both the proxy cache server and your web server.
If a user in China accesses your website, a connection to the proxy cache server is established. The proxy cache server checks whether the requested file already exists in the cache and provides a direct answer if it does. Otherwise, the proxy cache server establishes a connection to your web server and requests the desired resource. This data exchange between the proxy cache server in China and your web server in Germany runs over our direct lines between China and Europe, which guarantee reliability and good performance. As soon as the proxy cache server has received the resource, it is stored in the cache and delivered to the user. All sub-resources and further requests by the user then run according to the same principle.
Inexpensive alternative to a China CDN
Global CDNs do not generally include locations directly in mainland China. Although these can often be added as a fee-based extra option, such additional packages are generally very expensive. With a proxy cache server from WEBER.cloud China, you can create a delivery location for your website in China, without having to purchase an expensive add-on package for your global CDN - which means you can reduce your costs by up to 90% in comparison to a China CDN.
You should pay close attention to the following points when preparing your website
Internal links via the proxy cache server
For the generation of internal links for requests from the proxy cache server, it is important that your web server always uses the domain, via which the proxy cache server is accessed, as the basis for the links. For example, if your proxy cache server runs via the domain www.your-selected-name.com, and accesses your web server via the sub-domain www2.your-selected-name.com, your web server must use www.your-selected-name.com as the basis for internal links.
If your web server used internal links to www2.your-selected-name.com, the user in China would communicate directly with your web server in Europe after the first click on your website. This not only means they would bypass the proxy cache server, but also no longer benefit from our direct lines between Europe and China. In such a case, all access would be extremely slow for the user from this point onwards.
Avoid the integration of external resources
For these reasons, when making your website accessible in China via the proxy cache server (and in general), you should avoid the integration of third-party resources and instead store them directly on your web server. If this is not possible, you should definitely check whether the externally integrated resource can be accessed from China at all, and if possible, with a good level of performance. It may also be possible to switch to a Chinese alternative. We would be happy to analyze the load times of your externally integrated resources and advise you further - all you need to do is contact us.
Handling of encodings
The proxy cache server can work both with responses that have been encoded using Gzip and with responses without encoding. Brotli is currently not supported as an encoding methode.
The proxy cache server will inform your web server of the preferred encoding via Gzip (Accept-Encoding: gzip). Your web server can deliver the requested file either encoded (Content-Encoding: gzip) or without encoding. The supplied resource is then stored in the cache with the selected encoding method. To avoid storing multiple versions of the same file depending on the encoding, the proxy cache server can independently carry out encoding via Gzip or unpacking a file:
Whitelisting the IP address of the proxy cache server
Providing reliable access to your website in China via the proxy cache server is largely dependent on a connection being established between your web server in Europe and the proxy cache server in China. Unfortunately, from time to time it can happen that your website (or your hosting provider in general) has to fight off a DDoS attack or some other kind of attack. However, if the attack comes from China for example, a temporary defense mechanism is sometimes used, which simply blocks all access via Chinese IP addresses. While this stops the attack, it also stops your website from being accessible in China, because the proxy cache server no longer has access to your web server.
Our recommendation is therefore to whitelist the IP address of the proxy cache server so that such large-scale defenses do not have a negative impact on the accessibility of your website in China. Your WEBER.cloud China proxy cache server always has a static IP address, which is also linked directly to your ICP Filing and PSB Filing. A spontaneous or regular change of the IP address is not therefore possible.