Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., @awscloud, former CTO @artsy, +@vestris, NYC

Email Twitter LinkedIn Github Strava
Creative Commons License

Github has been petitioned, begged and implored to enable SSL on custom domains running on Github pages. They finally delivered SSL support with LetsEncrypt.

This is what I had to do for my Github pages Jekyll site at https://www.dblock.org. You can see the changes in www.dblock.org@5f6f047d.


Change url in _config.yml to https://www.dblock.org to fix asset and other internal links.

I couldn’t figure out how to make those relative to either HTTP or HTTPs.


Add a JavaScript redirect to _head.html from HTTP to HTTPs.

<script language="javascript">
  // Enforce SSL
  (function (root) {
    "use strict";
    var h = root ? root.location.hostname : "",
    p = root ? root.location.protocol : "";
    if ("http:" === p && !(/^(localhost| {
      root.location.protocol = "https:";
  ("undefined" !== typeof window ? window : this));

I couldn’t find a plugin that could make a 301 redirect before page load, something that Google recommends.


Include the JavaScript.

{% include _enforce_ssl.html %}