Skip to content

Instantly share code, notes, and snippets.

@nguyendat
Forked from cvan/HOWTO.md
Created August 1, 2018 10:52
Show Gist options
  • Save nguyendat/434b2dcad991d58bc1c82ce9d44ec66a to your computer and use it in GitHub Desktop.
Save nguyendat/434b2dcad991d58bc1c82ce9d44ec66a to your computer and use it in GitHub Desktop.
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Workflow

  1. Make sure you have registered your domain.
  2. Sign up for CloudFlare and create an account for that domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's.
  4. From the CloudFlare settings for that domain, enable SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification, which is a pretty cool feature if you don't want/have a build step for that.)
  5. On GitHub create a new repository to store all the site (preferably in the form of static web pages and assets, though for the A-Frame site we use something called Hexo - not necessary though, YMMV).
  6. Create a CNAME record to point aframe.io to aframevr.github.io. (See https://help.github.com/articles/tips-for-configuring-a-cname-record-with-your-dns-provider/.)
  7. In your repo, create a file called CNAME containing the domain name (e.g., aframe.io).
  8. Push to GitHub Pages (either by pushing to gh-pages of some ordinary repo; or you can use the master branch of a repo named after <org>.github.io - example: https://github.com/aframevr/aframevr.github.io/ automatically gets published to https://aframevr.github.io/)
  9. All content served to users is served from CloudFlare, originally served from the Fastly CDN (for initial page requests/cache misses), which is what every GitHub Pages asset is served from.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment