CDN acceleration for blogs

Let’s assume that you already know how to use Github Pages to host your own static blogging site, so you don’t have to pay to maintain your own cloud server, and you don’t have to write on an ad-filled blogging site. That’s nice, right? But Github Pages didn’t work well in China, often opening slowly or failing to open.

In order to improve the site access speed, in addition to reduce the number of requests page, streamline web rely on js, CSS files, the most commonly used is to use the CDN cache large files to a node on the server, so that when users visit the web site from the recent, pull the fastest response CDN node server resources, so as to improve the large file download speed.

What does it take to speed up a Github blog?

  1. Github Pages blog;
  2. A domain name of its own;
  3. Put your domain name on record;
  4. A free SSL certificate;

Ali Cloud full station accelerated DCDN

Ali cloud acceleration can use the whole station acceleration function.

Tencent Cloud Content distribution network CDN

  1. Add Tencent cloud CDN acceleration function for Github Pages
  2. Github Pages + CDN full-site acceleration

Loop redirection solution

I ran into a problem with the browser not being able to open the page due to too many redirects. At first, I made an analysis based on the investigation records and blogs of circular redirection problems after access to CDN/WAF, and made some adjustments. The problem was solved briefly. And then after that, I got redirected multiple times.

The cause of the error

Then by chance I noticed what Ali called huoyuan domain name and Tencent called Huoyuan HOST.

I mistakenly set the back source domain name as github domain name McOder2014.github. IO. I thought the concept of the back source was which warehouse I should go to fetch resources, but it seems that the CDN uses which website name to fetch resources.

Github Pages sets the custom domain name

Github Pages forces the user’s browser to jump to the user’s domain name after setting the CNAME custom domain name. Similarly, when we open McOder2014.github. IO when we do not use CDN, it will also jump to McOder. Cc. Result The CDN still uses McOder2014.github. IO to retrieve resources from the source.

I’m going to draw it like this.

The correct process is as follows: The CDN carries the correct address in the HTTP request, and Github sends the correct resource to the CDN, thus eliminating the problem of circular redirection.

Reference

  1. Records about the troubleshooting of circular redirection problems after CDN/WAF access