使用 cloudflare 為 github 頁面啟用 https
Github pages 目前不支援使用自訂網域的部落格使用 https,而 CloudFlare 可以解決這個問題。
Simple steps and instructions
- Register cloudflare account and add your custom domain;
- Go to domain registrar site and change dns servers to what cloudflare provides;
- Migrate dns resolving records to cloudflare (from previous/old domain registrar site);
- Ensure ssl setting is set to "Flexible SSL" on cloudflare setting;
Post-procedures
- Modify github pages "_config.yml" (e.g. jekyll powered)
url: https://your-domain-name # with the https protocol
enforce_ssl: your-domain-name # without any protocol
- Create cloudflare page rules to redirect http to https
$ http://*your-domain-name/*
$ => always use ssl
- Update static resources (css/js/html/image/etc) to use https url
參考文獻
- Set Up SSL on Github Pages With Custom Domains for Free
- How to host your static site with HTTPS on GitHub Pages and CloudFlare