Runar Ovesen Hjerpbakk

Programmer. Software Architect. Technical Manager.

Cloudflare

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