Runar Ovesen Hjerpbakk

Programmer. Software Architect. Technical Manager.

Jekyll

Automatically purge changed pages from the Cloudflare cache when adding a new post to Jekyll

This site is built with Jekyll, hosted on GitHub Pages, has DNS through Hover and is served by the Cloudflare CDN. The site is static, that is all pages are rendered ahead of time on the server. That means that even the simplest web server in the world could host hjerpbakk.com without issue. So why is Cloudflare a part of this stack?

I put it behind Cloudflare for three reasons:

  • Real simple TLS
  • Security, Cloudflare can protect you from DDoS attacks (not that this is an issue for me) and has a looong list of known bad players which are blocked from accessing your site.
  • Performance, Cloudflare has a global CDN and an excellent cache. Thus, your own server is hit far less than without this outer layer.

Since Cloudflare has a cache, how do you make sure the right parts of the cache are invalidated when you create new content? With a simple dotnet script that’s how!

Read More

Jekyll error - bad Request-Line

I use the excellent Jekyll to create this and a couple of other websites. Jekyll is a static website generator written in Ruby and plays very nicely with GitHub Pages.

But since it’s software, after all, it too needs updating once in a while. And as you know dear readers, all software sucks.

So I updated jekyll and other needed gems and tried to serve the page locally:

$ bundle exec jekyll serve --drafts --watch --baseurl '' --config _config.yml,_config-dev.yml --limit_posts 10
Configuration file: _config.yml
Configuration file: _config-dev.yml
            Source: /Users/hjerpbakk/projects/hjerpbakk.github.io
       Destination: /Users/hjerpbakk/projects/hjerpbakk.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
                    done in 12.903 seconds.
 Auto-regeneration: enabled for '/Users/hjerpbakk/projects/hjerpbakk.github.io'
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03?t&,?\x1E??\x1AJmc?_?U??c\x00<'.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03aS?PP???c?\x1Ab~?K'\x13\b\x00w????M?8?\x7FK/\x00\x00.?,?+?$?#?'.
[2018-03-20 16:40:31] ERROR bad URI `?'.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03?~F?Еs''?ʓ???\x16??e?#\b?\x05a+?{\x18ܬ\x00\x00(?,?+?$?#?'.
[2018-03-20 16:40:31] ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x03 ?<\x18J3z??{?\x03?KĘ*?\r??`"+y"L?F??P\x00\x00.?,?+?$?#?'.
[2018-03-20 16:40:31] ERROR bad URI `?'

Bad request lines as far as the eye can see.

Read More

Enabling https on a Jekyll site

The attentive reader has already noticed that hjerpbakk.com finally is served over https. Even though this is a wholly static website written using Jekyll, you my dear readers, deserve your privacy.

Read More