How to configure redirect from www to non-www in Cloudflare using Terraform

Preface I ran a bunch of tools to check if my blog is SEO-friendly. One of the recommendation was to canonicalize the URLs by avoiding multiple addresses pointing to the same page. In my case, that was serving my website at both https://www.simonko.dev, as well as https://simonko.dev. The solution is rather simple - redirect www to non-www. My website is fully configured using Terraform. Since I’ve never done it before with Cloudflare Terraform provider, I thought I might share what I did. ...

June 2, 2025 · 3 min · 524 words · Simon

Blog Setup Automation

Preface In my previous post, I shared the steps I followed to set up a blog and promised to automate the Cloudflare setup. My goal was to automate as much as possible, minimize manual steps and establish a repeatable process, so I started exploring the use of Infrastructure as Code (IaC) for Cloudflare configuration. I reached a point where everything is automated except for: Domain purchase Terraform state storage (Cloudflare R2) Linking Cloudflare and GitHub accounts Cloudflare access tokens This is acceptable since these are one-off activities. Now, I can destroy and recreate my Cloudflare setup in just a few seconds. ...

April 29, 2025 · 8 min · 1597 words · Simon

Starting a blog

Preface I started writing this post while my blog wasn’t yet published. The idea of setting up a blog has been developing in me for a while now. Over the past few weeks I’ve gone through several posts on the topic on Reddit to, confronted the plan with my wife, as well as with Google Gemini and reached a point where I just needed to start doing. I’ve bought the domain via Cloudflare and started setting up the blog locally. I am not a graphics designer or a frontend developer and I didn’t want to spend too much time maintaining that. I wanted to focus on content and wanted to do it as cheap as possible, with least maintenance burden, as well as not need to worry about the security of underlying infrastructure. A statically generated website hosted somewhere sounded perfect. I settled on Cloudflare Pages, but there’s plethora of options available: AWS Amplify, Netlify, Github Pages. Having the content of my website version controlled along the rest of the code sounded appealing to me as well. ...

April 12, 2025 · 4 min · 791 words · Simon