Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Cloudflare to add HTTPS support for GitHub Pages-based Hexo blogs

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail how to use Cloudflare to add HTTPS support for Hexo blog based on GitHub Pages. The content of the article is of high quality, so Xiaobian shares it with you as a reference. I hope you have a certain understanding of relevant knowledge after reading this article.

Cloudflare adds HTTPS support to Hexo blogs based on GitHub Pages

HTTP (Hypertext Transfer Protocol) is a request-and-response, stateless, application-layer protocol, often based on TCP/IP protocol to transmit data, the most widely used network protocol on the Internet, all WWW files must comply with this standard. HTTP was originally designed to provide a way to publish and receive HTML pages.

HTTPS (Hypertext Transfer Security Protocol) is a security-oriented HTTP channel, simply a secure version of HTTP. That is, add SSL layer under HTTP. The security foundation of HTTPS is SSL, so SSL is required for the details of encryption. It is a URI scheme (abstract identifier system), syntactically similar to http: scheme. For secure HTTP data transmission.

- preface

GitHub Pages comes with domain names (xxx.github.io) supports opening https service. You can check [Enforce HTTPS] under [Settings]-[GitHub Pages] of the repository. However, if you set up a custom domain name, it will be more complicated, because hexo blog is hosted on GitHub and does not have its own server, so it does not support uploading SSL Certificates. From May 1, 2018, GitHub officially also supports custom domain names to open https. The implementation method can refer to my article: "Using official support to enable HTTPS for Hexo blogs based on GitHub Pages". Another method is to use Cloudflare's CDN transit to enable HTTPS. The disadvantage of this method is that domestic access speed may slow down. This article mainly describes this method.

Cloudflare is an American multinational technology enterprise. Its main business is to provide customers with website security management, performance optimization and related technical support. It provides free https service. Note that SSL Certificates are not applied. Implementation principle: The connection between users and CDN servers is https mode, while the connection between CDN servers and GithubPages servers is http mode. Reverse proxy is added to CDN servers.

- sign up for Cloudflare

Go to Cloudflare official website to register an account

- add site

Add your site, go to the next step

If you have already resolved the domain name at the domain name service provider, then a list of domain name resolutions will appear. If you have not resolved it yet, you can refer to Configure a personalized domain name for hexo blog.

- Modify DNS

Click Next and Cloudflare will give you two DNS addresses.

Go to the domain name service provider to modify DNS. Take Alibaba Cloud as an example. Select Console-Domain Name, select your domain name, click Manage-Modify DNS, and fill in the two DNS addresses provided by Cloudflare. It will take a few minutes to take effect.

- Open HTTPS

On the Cloudflare management page, click the [Crypto] option and select the SSL mode as [full]. Note: After activating the site on Cloudflare, it may take 24 hours to issue a new certificate. Just wait patiently.

The difference between Flexible, Full and Full (Strict) is:

Flexible: visitors and Cloudflare are encrypted, Cloudflare to site server is not encrypted

Full: Visitor to Cloudflare, Cloudflare to site server are encrypted, it does not verify whether the certificate on your server is valid, so you can install any certificate on your server, including self-signed certificates.

Full (strict): visitors to Cloudflare, Cloudflare to the site server are encrypted, it will verify whether the certificate on your server is legitimate, you must have a trusted CA certificate installed on your server, and this certificate must be unexpired, containing domain name and other information.

At this point, our domain name supports https access, but when the user enters http://xxxx to access, the browser will still access the http protocol and will not jump to https. At this time, we need to use redirection to solve the problem.

- Redirect Force HTTPS

Cloudflare provides a page rule function called Page Rules. We can use this function to do some processing on URLs. When the user visits HTTP, redirect to HTTPS. Click the [Page Rules] option and click [Create Page Rules] to create the following rules and save them.

Now our Hexo blog is full of HTTPS!

About how to use Cloudflare to add HTTPS support for Hexo blog based on GitHub Pages to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report