Enable https for github pages with cloudflare

Github pages currently does not support https for blogs that use custom domain name, and here is what CloudFlare comes to a rescue.

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;


  • 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