Search Blog for


How to Set Up Fast and Secure Website Access for Your Customers in China

Many multinational companies expanding into China require a dedicated Chinese-language website for their local customers. These companies often host their .cn websites in their existing hosting environment outside of China so all websites can be managed in a single environment. Network and service providers within China have different specifications and regulations. As a result, companies looking to set up their websites are often unsure of the best ways to get a fast CDN in China, while maintaining the same level of security as their main English language site and complying with regulations.

We are glad to announce a partnership with ChinaCache that helps organizations manage all these requirements through one integrated system. Companies can get advanced security solutions from Imperva Incapsula and simultaneously access ChinaCache, one of the fastest CDNs in China. Through our partnership, organizations can now get the same level of performance and security for their Chinese-language websites they have come to expect with their other web properties.

 How Does It Work?


With Incapsula CDN and ChinaCache CDNs now connected, Incapsula clients that deploy a localized website in China can leverage ChinaCache as the primary CDN for improving performance for their Chinese language site. Here’s how it works:

  • Incapsula acts as the origin server for ChinaCache, effectively providing a second advanced-level CDN with the added security of a direct connection to the origin server.
  • Customers in the rest of the world can use Incapsula as their CDN to access English language sites.
  • Incapsula provides standard security services such as WAF and DDoS mitigation from Incapsula PoPs for all websites. As a result, the security policies for all websites using ChinaCache are uniform with protection levels identical for all websites.
  • Incapsula acts as the origin server for ChinaCache CDN. For any content that is not cached, ChinaCache forwards the request to Incapsula. Incapsula then delivers the content from its cache or forwards the request to the origin server. There is minimal latency with this arrangement.
  • A single integrated support model. Customers can contact ChinaCache or Incapsula to get their issues resolved.

How ChinaCache Configured NGINX Headers to Accept HTTP Requests

To facilitate the relationship with Incapsula, ChinaCache has set up its CDN in front of Incapsula so that ChinaCache handles the acceleration and availability of the services in China. “Our challenge was to ensure that the headers are sent to the Incapsula origin servers as if the client is sending the request directly to their nodes, while still keeping debug headers for our end following the client sent headers,” said Joshua Santos, Architect, ChinaCache.

ChinaCache implemented the following solution:

  • Its CDN receives the request from the client.
  • Using an NGINX lua script, the CDN grabs the raw request headers and then iterates through them, storing them in temporary headers as if they were sent raw.
  • ChinaCache adds debug headers at the end and sends it through an HTTP client (sub request) written in Lua to its caching layers.
  • Finally before sending to Incapsula origin, the headers are written to be as the client sent them to the ChinaCache CDN edge node.
  • Sample below is for illustration – has been modified for the blog.code snippet

10x Performance Improvement

To date we have seen close to a 10 X improvement in performance for Chinese language website customers who are using both ChinaCache and Incapsula in the manner described above. With HTTPS support in place, customers do not need to compromise their security to get such a significant improvement in the performance of their websites.