Skip to content

Instantly share code, notes, and snippets.

@ErikAndreas
Created May 3, 2017 12:43
Show Gist options
  • Save ErikAndreas/3d25b288f3cd7c85f9f3875cc9e33ecb to your computer and use it in GitHub Desktop.
Save ErikAndreas/3d25b288f3cd7c85f9f3875cc9e33ecb to your computer and use it in GitHub Desktop.
https via Cloudflare with github pages on custom domain with redirect to www
  1. assuming you already have your domain, will use domain.com as example and you have your github pages, will use username.github.io as example
  2. register for cloudflare account
  3. get cloudflare nameservers for your domain, e.g xxx.ns.cloudflare.com and yyy.ns.cloudflare.com
  4. update dns settings for your domain with the cloudflare nameservers and check status (might take a while)
  5. cloudflare dns settings -> add 2 A records; name: domain.com, value 192.30.252.153 and value 192.30.252.154 as per github pages instructions
  6. cloudflare dns settings -> add cname record; name www, value (is an alias of) username.github.io
  7. cloudflare page rules -> domain.com/* forwarding URL https://www.domain.com/$1 301 permanent redirect
  8. cloudflare page rules -> http://www.domain.com/* Always use https
  9. settings on your github pages repo -> custom domain 'www.domain.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment