How to configure Vercel domains with Alibaba CDN for China Mainland

Hi

We want to migrate our site from on-prem to Vercel. For most of the domains, this was straight forward and worked well. But for the site targeting customers in China Mainland it gets a bit tricky as we need to route the traffic through servers which do have a license to operate in China Mainland - we use the Alibaba CDN for this.

Current Architecture

Our current setup (on-prem origin / Vercel not involved) looks like this:

site.cn
   ↓
Alibaba CDN
   ↓
cn.site.com (while preserving the host header: Host: site.cn)
   ↓
origin server (on-prem)

So users in China Mainland visit site.cn which is pointing to Alibaba which is then requesting the actual content from our origin servers at cn.site.com but preserve the Host header, so the origin renders the site as running under site.cn (important!)

Proposed Vercel Setup

The setup with Vercel should look something like this:

site.cn
   ↓
Alibaba CDN
   ↓
cn.site.com (while preserving the host header: Host: site.cn)
   ↓
Vercel
   ↓
Our-Vercel-Project (Configured Domains: cn.site.com, site.cn)

Problems Encountered

When we now want to migrate this setup to Vercel, several problems occur:

  1. We can change the DNS record of cn.site.com to point to Vercel but since the Host header of the requests sent by the Alibaba CDN is set to site.cn, Vercel will not be able to map them to the correct project.
  2. If we also configure site.cn as a domain for the Vercel project, it will not work because the DNS record for this domain does not point to Vercel but Alibaba. Therefore Vercel will state a misconfigured domain and will not map requests with the respective Host header to this project (and we will also not have a valid certificate).
  3. If we do not preserve the Host header on the Alibaba requests (sending Host: cn.site.com in the requests to Vercel), the requests will end up on our project in Vercel but it will run in the wrong context of cn.site.com instead of site.cn and therefore render wrong content (e.g. URLs pointing to cn.site.com instead of site.cn).

I guess this is quite a common problem / setup for sites also serving users in China Mainland so we are surely not the first ones facing this issue. How is this usually solved? I expected that I could add some TXT record to the site.cn DNS entry to verify domain ownership to Vercel (e.g. TXT _vercel.site.cn = vc-domain-verify=abc123) but this seems to be only used to transfer domain ownership between Vercel accounts.

We do have full control over the DNS records but they are not managed via Vercel but a 3rd party provider.

Any help is appreciated!

Thanks, Peter

1 Like

The domain troubleshooting guide can help with most custom domain configuration issues. You might be able to use that guide to solve it before a human is available to help you. Then you can come back here and share the answer for bonus points.

You can also use v0 to narrow down the possibilities.

1 Like