Due to slow access speeds within China for GitHub Pages, the author applied for a personal domain and purchased CDN acceleration services from a domestic cloud hosting provider. During configuration, they encountered an issue where the www subdomain was inaccessible, ultimately resolved by removing wildcard domain resolution and setting up the second-level domain separately. The author also shared the principles and configuration experience of CDN acceleration, as well as their attempts and lessons learned using Nginx reverse proxy.
Background
The website is hosted on GitHub Pages, which can be slow to access from within China for certain well-known reasons. Therefore, I applied for a personal domain and purchased CDN acceleration services from a domestic cloud hosting provider. While setting up the acceleration service, I realized I had a development machine with Docker, frp, k8s, and other services deployed – all of which have dashboards. Following the principle of not letting resources go to waste, I configured several reverse proxies and linked them to subdomains.
When I was happily using my second-level domain, I suddenly found that the www subdomain was inaccessible. The DNS configuration in Alibaba Cloud resolves both www.xiangtianlong.com and xiangtianlong.com simultaneously. Before enabling CDN acceleration, both domains worked correctly.
When configuring CDN acceleration, enabling a wildcard domain rule due to having too many subdomains resulted in the www subdomain also failing. Yes, you read that right – the www prefix is considered a subdomain. The actual website is deployed on GitHub Pages, and the development machine has no cached web content.
Using GitHub Actions for automated deployment is surprisingly convenient for a static blog
domain
Non-professional web development doesn’t involve understanding SEO or cross-domain issues. For a blog site, using a bare domain can highlight the blogger’s site—which is exactly my situation with using Chinese pinyin as a domain name—and also helps reduce character input, especially given the prevalence of mobile access.
The desktop version allows you to skip typing “www” and “com” using keyboard shortcuts
CDN
I’ve used both Alibaba Cloud and Tencent Cloud; they are easy for new users to get started with. Tencent Cloud even has a video explaining the related concepts. The principle of CDN acceleration is the same as that of JD’s warehouse: when launching new products, they are pre-distributed to warehouses across the country, and delivery requests are fulfilled from the nearest location.
Return address: The original location where website resources were stored
Cache file settings, browser F12, management console, simple analysis of static and dynamic resources
- All 0-day validity
- 0-day validity
- 1-day validity
Tencent Cloud Configuration Rules:
- Up to 10 cache expiration rules can be configured
- The priority of cache expiration rules is bottom-up
- Cache expiration time can be set up to 365 days
A Lamentable Confession
I hadn’t used Nginx before and thought I could understand reverse proxy configuration just by searching online. However, it was confusing; after a lot of effort, I couldn’t even get a 302 redirect working, rendering the whole thing useless. So, I decided on a simple solution: removing the wildcard domain resolution and setting up each subdomain independently. That’s when I noticed Aliyun DNS had a “Display URL Jump” mode – exactly what I needed for a 302 redirect.
After setting up the first subdomain and confirming it worked, I ran into issues with the second. I almost started doubting myself, but then it suddenly started working after a wait. It seems Aliyun’s DNS propagation occasionally glitches.
References
- Please provide the Chinese text you want me to translate. I am ready when you are! Just paste the text here.
- Please provide the Chinese text you want me to translate. I am ready when you are! Just paste the text here.
- Please provide the Chinese text you want me to translate. I am ready when you are! Just paste the text here.